繁体   English   中英

无法在 mac 上安装 psycopg2

[英]Unable to install psycopg2 on mac

我已经使用“pip install postgresql”在我的 Mac 上安装了最新版本的 postgresql。 我还在我的 Mac 上安装了 libpq,它包含 psycopg2 所需的所有 header 文件。 我已经搜索了 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

作为替代方案,您可以使用“pipenv”在Python中准备一个虚拟环境而不使用“pip”,我认为您可以创建它而不受其他环境的影响。 我将向您展示如何创建一个简单的虚拟环境。

pip install pipenv #Installation of pipenv

cd [Development directory] #Move to the directory you are developing

pipenv install --python 3.6.8 #Specify the version you want to use

pipenv install psycopg2 #Install the package

pipenv shell #Enter the virtual environment

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM