2018-12-18

在装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,只需要去官网下载就行了。

2 安装Xcode的组件Command Line Tools

3 #python setup.py clean

#python setup.py build

#sudo python setup.py install

作者:柳絮不飞

链接:https://www.jianshu.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

版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(2018-12-18)