【发布时间】:2021-08-06 19:04:57
【问题描述】:
我已经使用“pip install postgresql”在我的 Mac 上安装了最新版本的 postgresql。我还在我的 Mac 上安装了 libpq,它包含 psycopg2 所需的所有头文件。我已经搜索了 psycopg2 需要它们的所有先决条件,但是当我尝试使用 pip3 install psycopg2 安装它时,我遇到了很多错误并且找不到任何解决方案。我阅读了很多答案,网站有所帮助,但没有任何帮助。以下是我遇到的错误。
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
【问题讨论】:
-
你可以试试
pip install psycopg2-binary——它们是预制的轮子,在这里可能更适合你。 -
使用二进制版本有什么问题吗?还是一切都和使用 psycopg2 一样?
-
如果 psycopg2-binary 编译的库版本与您机器上存在的库版本不同,您可能会遇到错误 - 我曾经在 openSSL 中遇到过这种情况 - 但相对而言在我的经验中很少见。
标签: python postgresql macos pip psycopg2