Mac中 pip3 install mysqlclient 报错

主要错误提示如下:

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

  ----------------------------------------
  Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient

最下方的报错是:


image.png

这个错误百度+Google查了很久都没有找到正确的解决方法,浪费了很多时间,使得我认为非常有必要把解决方法写出来,防止再有其他人浪费生命.真不知道为什么很少有人遇到和我同样的错误,唯一的解决方法是使用下方命令进行安装:
LDFLAGS=-L/usr/local/opt/openssl/lib pip3 install mysqlclient

参考链接:https://github.com/PyMySQL/mysqlclient-python/issues/131

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

推荐阅读更多精彩内容