[英]Unable to install psycopg2 on mac
I have installed the latest version of postgresql on my mac using "pip install postgresql".我已经使用“pip install postgresql”在我的 Mac 上安装了最新版本的 postgresql。 I have also installed libpq on my mac and it contains all header files needed for psycopg2.
我还在我的 Mac 上安装了 libpq,它包含 psycopg2 所需的所有 header 文件。 I have searched for all prerequisities that psycopg2 needs them but when i try to install it using pip3 install psycopg2 i got a lot of errors and can't find any resolution for that.
我已经搜索了 psycopg2 需要它们的所有先决条件,但是当我尝试使用 pip3 install psycopg2 安装它时,我遇到了很多错误并且找不到任何解决方案。 I read a lot of answers and site helps but nothing helped me.
我阅读了很多答案,网站有所帮助,但没有任何帮助。 The following are the errors i have encountered.
以下是我遇到的错误。
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
As an alternative, you can use "pipenv" to prepare a virtual environment in Python without using "pip", and I think you can create it without being affected by other environments.作为替代方案,您可以使用“pipenv”在Python中准备一个虚拟环境而不使用“pip”,我认为您可以创建它而不受其他环境的影响。 I'll show you how to create a simple virtual environment.
我将向您展示如何创建一个简单的虚拟环境。
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.