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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。