简体   繁体   English

在 windows 上的 vscode 中安装 psycopg2 时出错

[英]getting error while installing psycopg2 in vscode on windows

I am trying pip install psycopg2 in vscode cmd on windows 8.1, which results in the following error.我正在尝试pip install psycopg2 ,这会导致以下错误。

ERROR: Command errored out with exit status 1:
   command: 'c:\users\rock\envs\demo\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\rock\\AppData\\Local\\Temp\\pip-install-fczxt3cu\\psycopg2\\setup.py'"'"'; __file__='"'"'C:\\Users\\rock\\AppData\\Local\\Temp\\pip-install-fczxt3cu\\psycopg2\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\rock\AppData\Local\Temp\pip-wheel-i_fkxw14' --python-tag cp38
       cwd: C:\Users\rock\AppData\Local\Temp\pip-install-fczxt3cu\psycopg2\
  Complete output (22 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\psycopg2
  copying lib\compat.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\errorcodes.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\errors.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\extensions.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\extras.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\pool.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\sql.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\tz.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\_ipaddress.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\_json.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\_lru_cache.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\_range.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\__init__.py -> build\lib.win-amd64-3.8\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/

The solution is in the error message.解决方案在错误消息中。 You need the Visual C++ runtime installed.您需要安装 Visual C++ 运行时。 Go to Go 至

https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads

and download the version appropriate to your system, then install and try again.并下载适合您系统的版本,然后安装并重试。

EDIT: Correct answer编辑:正确答案

The error message is misleading in this case.在这种情况下,错误消息具有误导性。 It's an issue with psycopg, it doesn't appear to support Python 3.8 on Windows yet.这是 psycopg 的问题,它似乎还不支持 Windows 上的 Python 3.8。 Solution is to use 3.7 until psycopg is ready.解决方案是使用 3.7 直到 psycopg 准备好。

https://github.com/psycopg/psycopg2/issues/990 https://github.com/psycopg/psycopg2/issues/990

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

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