无法在 MacOS 上通过 pip install 安装 psycopg2 包 [英] Can't install psycopg2 package through pip install on MacOS
本文介绍了无法在 MacOS 上通过 pip install 安装 psycopg2 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为我的一个讲座开展一个项目,我需要下载包 psycopg2 才能使用正在使用的 postgresql 数据库.不幸的是,当我尝试 pip install psycopg2 时,会弹出以下错误:
I am working on a project for one of my lectures and I need to download the package psycopg2 in order to work with the postgresql database in use. Unfortunately, when I try to pip install psycopg2 the following error pops up:
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
有谁知道为什么会这样?提前致谢!
Does anyone know why this is happening? Thanks in advance!
推荐答案
我通过安装命令行工具解决了这个问题
I fixed this by installing Command Line Tools
xcode-select --install
然后通过 Homebrew 安装 openssl 并手动将我的 homebrew 安装的 openssl 链接到 pip:
then installing openssl via Homebrew and manually linking my homebrew-installed openssl to pip:
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
在 macOS Sierra 10.12.1 上
on macOS Sierra 10.12.1
这篇关于无法在 MacOS 上通过 pip install 安装 psycopg2 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文