pip安装mysqlclient出现的问题

我的情况是

pipenv install mysqlclient

时候报错

An error occurred while installing mysqlclient==1.3.13!
...
...
...
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
...
...
...

但是似乎

pip install mysqlclient

也会遇到同样的问题

经过很久的搜索终于找到了解决方案

在~/.bashrc 或者 ~/.zshrc 里面添加环境变量

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PATH="/usr/local/opt/openssl/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

然后source .bashrc

参考:

https://www.jianshu.com/p/d4a349a7e7f5
https://www.jianshu.com/p/c635d239f41c

你可能感兴趣的:(pip安装mysqlclient出现的问题)