Mac OS / Python · 2019-08-21

mac解决安装mysql-python错误my_config.h

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

出现下列错误:

ld: library not found for -lssl

解决:

sudo env LDFLAGS=”-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib” pip install MySQL-python