我正在为我的一个讲座开发一个项目,我需要下载 psycopg2 包才能使用正在使用的 postgresql 数据库。不幸的是,当我尝试 pip install psycopg2 时,会弹出以下错误:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1
为什么会发生这种情况?
我通过安装命令行工具解决了这个问题
xcode-select --install
然后通过 Homebrew 安装 openssl 并手动将我的 homebrew 安装的 openssl 链接到 pip:
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
在 macOS Sierra 10.12.1 上
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)