簡體   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