在裝mysql for python 的時候又遇到問題?
(venv) wpfdeiMac:dj_test2 wpf$ pip install MySQL-python
??_mysql.c:44:10: fatal error: 'my_config.h' file not found
? #include "my_config.h"
?? ? ? ? ? ^~~~~~~~~~~~~
? 1 error generated.
? error: command 'cc' failed with exit status 1
參考1
1)將下載的MySQL-python-1.2.5的文件解壓堕义,然后打開編輯器編輯site.cfg热某,其中有一行#mysql_config = /usr/local/bin/mysql_config,把“#”去掉然后更改為:mysql_config = /usr/local/mysql/bin/mysql_config胳螟,這里注意了,/usr/local/mysql/bin/mysql_config
是我的mysql的安裝地址糖耸。也就是說安裝之前需要先安裝mysql秘遏,只需要去官網(wǎng)下載就行了嘉竟。
2 安裝Xcode的組件Command Line Tools
3 #python setup.py clean
#python setup.py build
#sudo python setup.py install
作者:柳絮不飛
鏈接:http://www.reibang.com/p/ca0281c96fe4
來源:簡書
參考2
brew install mysql
brew unlink mysql
brew install mysql-connector-c
sed -i -e 's/libs="$libs -l "/libs="$libs -lmysqlclient -lssl -lcrypto"/g' /usr/local/bin/mysql_config
pip install MySQL-python
brew unlink mysql-connector-c
brew link --overwrite mysql
---------------------
作者:Jorah_Bronn
來源:CSDN
原文:https://blog.csdn.net/eri_feng/article/details/81224106
版權(quán)聲明:本文為博主原創(chuàng)文章邦危,轉(zhuǎn)載請附上博文鏈接洋侨!