2019-07-03 OSX 安装 mysqlclient 报错 ld: library not found for -lssl

clang -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/_mysql.cpython-37m-darwin.so
  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
  ----------------------------------------
  ERROR: Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient
  Building wheel for uWSGI (setup.py) ... done
  Stored in directory: /Users/Qinfei/Library/Caches/pip/wheels/09/49/31/3098c71b6fe30eaedc682a589fe65ce9fcf8411281d4e05ec8
Successfully built uWSGI
Failed to build mysqlclient
Installing collected packages: pytz, Django, django-mathfilters, redis, django-redis, django-suit, mysqlclient, passlib, Pillow, uWSGI
  Running setup.py install for mysqlclient ... error

主要的报错信息是这个:

    ld: library not found for -lssl    # 主要信息在这里 

gcc找不到这个库

我们使用以下便可解决

brew install openssl
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ 

参考资料:
ld: library not found for -lssl after Mac OS Sierra upgrade · Issue #795 · brianmario/mysql2​github.com

你可能感兴趣的:(2019-07-03 OSX 安装 mysqlclient 报错 ld: library not found for -lssl)