mac下 python2.7安装MySQL-python碰到很多问题:
1. pip install MySQL-python 总是报这个错
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/2w/tt1p_4td3yq9xlbl7c2t4jn00000gn/T/pip-install-TkmPbl/MySQL-python/
2. 使用安装包安装时,却总是报这个
_mysql.c:35:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
百度搜了很多文章都没能解决这个问题,都千篇一律 。。。
最终用这种方法解决,顺手记下来,希望能有所帮助
brew install mysql
brew unlink mysql
brew install mysql-connector-c #或者已经安装了的话 brew link 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
参考链接:
本文解决了在Mac上使用Python2.7安装MySQL-Python遇到的问题,包括pip安装失败和_my_config.h文件未找到的错误。通过brew安装mysql和mysql-connector-c,修改mysql_config文件,并重新安装MySQL-Python,成功解决问题。
1816

被折叠的 条评论
为什么被折叠?



