在windows 10中编写pip install psycopg2以将python与我的django项目的postgres连接时出错

在windows 10中编写pip install psycopg2以将python与我的django项目的postgres连接时出错,python,python-3.x,django,pip,psycopg2,Python,Python 3.x,Django,Pip,Psycopg2,我正在为Django项目安装psycopg2以连接Postgres,但出现以下错误: 当我运行此命令时: pip安装psycopg2 在Windows上,我遇到以下错误: C:\Users\Aman>pip install psycopg2 Collecting psycopg2 Using cached psycopg2-2.8.5.tar.gz (380 kB) Using legacy setup.py install for psycopg2, since package 'whe

我正在为Django项目安装psycopg2以连接Postgres,但出现以下错误:

当我运行此命令时:

pip安装psycopg2 在Windows上,我遇到以下错误:

C:\Users\Aman>pip install psycopg2 Collecting psycopg2 Using cached psycopg2-2.8.5.tar.gz (380 kB) Using legacy setup.py install for psycopg2, since package 'wheel' is not installed. Installing collected packages: psycopg2 Running setup.py install for psycopg2 ... error ERROR: Command errored out with exit status 1: command: 'c:\users\aman\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Aman\\AppData\\Local\\Temp\\pip-install-8u0ripm3\\psycopg2\\setup.py'"'"'; __file__='"'"'C:\\Users\\Aman\\AppData\\Local\\Temp\\pip-install-8u0ripm3\\psycopg2\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Aman\AppData\Local\Temp\pip-record-dasbftyv\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\aman\appdata\local\programs\python\python39\Include\psycopg2' cwd: C:\Users\Aman\AppData\Local\Temp\pip-install-8u0ripm3\psycopg2\ Complete output (22 lines): running install running build running build_py creating build creating build\lib.win-amd64-3.9 creating build\lib.win-amd64-3.9\psycopg2 copying lib\compat.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\errorcodes.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\errors.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\extensions.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\extras.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\pool.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\sql.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\tz.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\_ipaddress.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\_json.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\_lru_cache.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\_range.py -> build\lib.win-amd64-3.9\psycopg2 copying lib\__init__.py -> build\lib.win-amd64-3.9\psycopg2 running build_ext building 'psycopg2._psycopg' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\users\aman\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Aman\\AppData\\Local\\Temp\\pip-install-8u0ripm3\\psycopg2\\setup.py'"'"'; __file__='"'"'C:\\Users\\Aman\\AppData\\Local\\Temp\\pip-install-8u0ripm3\\psycopg2\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Aman\AppData\Local\Temp\pip-record-dasbftyv\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\aman\appdata\local\programs\python\python39\Include\psycopg2' Check the logs for full command output.
如何修复此错误?

错误显示:

Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ 
安装此VisualStudio构建工具,可能需要遵循该链接。

是的,它需要v.ccp14,链接用于在线安装,如果出于任何原因,您想先离线安装,则必须先创建一个软件包,然后再安装该软件包。这个链接有帮助吗