无法在mac上安装psycopg2

2024-05-16 02:51:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经使用“pip安装postgresql”在mac上安装了最新版本的postgresql。我还在mac上安装了libpq,它包含psycopg2所需的所有头文件。我已经搜索了psycopg2需要的所有先决条件,但是当我尝试使用pip3安装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

Tags: pip版本头文件先决条件postgresqlmac错误with
1条回答
网友
1楼 · 发布于 2024-05-16 02:51:24

作为替代方案,您可以使用“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

相关问题 更多 >