在macbook pro上,用pip下载了virtualenv,source ./bin/activate激活它,再pip install mysql-python
出现了很奇怪的error:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysql-python
在stackoverflow上搜了一天多才找到解决方法,用下面语句代替pip install mysql-python
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysql-python
问题解决啦
题外话1:
还有一些人用xcode-select --install
能解决问题
stackoverflow原网站:
https://stackoverflow.com/questions/43634584/cant-install-mysql-python-with-pip-on-macos-10-12-4/43645248?newreg=fc9a88f395fe43389c4f4bf1bd9bb5d2
题外话2:
下载mysql-python的完整步骤:
前提:在virtualenv下
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