macOSX pip install mysql-python 出错解决办法

在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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值