为了账号安全,请及时绑定邮箱和手机立即绑定

无法在 mac os x mojave 上安装 mysqlclient

无法在 mac os x mojave 上安装 mysqlclient

蓝山帝景 2021-08-05 15:46:58
我正在尝试在 mac os x mojave 上安装 mysqlclient:sudo pip3 install mysqlclient我收到以下错误:clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 -I/usr/local/Cellar/mysql/8.0.12/include/mysql -I/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c _mysql.c -o build/temp.macosx-10.13-x86_64-3.6/_mysql.o    clang -bundle -undefined dynamic_lookup build/temp.macosx-10.13-x86_64-3.6/_mysql.o -L/usr/local/Cellar/mysql/8.0.12/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.13-x86_64-3.6/_mysql.cpython-36m-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    ----------------------------------------Command "/Users//Development/apps/hid_ve/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-1mo7e_ok/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-9bwluwz6/install-record.txt --single-version-externally-managed --compile --install-headers /Users//Development/apps/hid_ve/bin/../include/site/python3.6/mysqlclient" failed with error code 1 in /private/tmp/pip-install-1mo7e_ok/mysqlclient/
查看完整描述

3 回答

?
慕尼黑5688855

TA贡献1848条经验 获得超2个赞

升级到 mojave 后,我遇到了和你一样的错误。经过一番挖掘,以下步骤有所帮助:


brew info openssl

输出很有用。如果您使用的是bash或zsh,则消息为:


要让编译器找到 openssl,您可能需要设置:


export LDFLAGS="-L/usr/local/opt/openssl/lib"

export CPPFLAGS="-I/usr/local/opt/openssl/include"

执行上述命令后,一切恢复正常。😁


此外,如果您使用的是fish。消息是:


要让编译器找到 openssl,您可能需要设置:


set -gx LDFLAGS "-L/usr/local/opt/openssl/lib"

set -gx CPPFLAGS "-I/usr/local/opt/openssl/include"


查看完整回答
反对 回复 2021-08-05
?
ITMISS

TA贡献1871条经验 获得超8个赞

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


查看完整回答
反对 回复 2021-08-05
  • 3 回答
  • 0 关注
  • 189 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信