最近项目移植, 再进行virtualenv环境安装的时候遇到mysql-python死活安装失败
首先是这个错误:
sh: /usr/local/bin/mysql_config: No such file or directory
Traceback (most recent call last):
File "setup.py", line , in <module>
metadata, options = get_config()
File "/Users/jackey/Downloads/MySQL-python-1.2.5/setup_posix.py", line , in get_config
libs = mysql_config("libs_r")
File "/Users/jackey/Downloads/MySQL-python-1.2.5/setup_posix.py", line , in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: /usr/local/bin/mysql_config not found
解决办法:
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib"
然后又出现这个错误
_mysql.c::: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
error generated.
error: command 'cc' failed with exit status
解决办法:
brew install mysql
brew unlink mysql
brew install mysql-connector-c
sudo sed -i -e 's/libs="$libs -l "/libs="$libs -lmysqlclient -lssl -lcrypto"/g' /usr/local/mysql/bin/mysql_config