python - 无法在 Windows 上安装 psycopg2 2.8.6
问题描述
我无法在我的 Windows 上安装 psycopg2 2.8.6 或 psycopg2-binary。安装时出现以下错误。
PS C:\Users\UserName\Desktop\PythonUnitTestFW> pip install psycopg2-binary 收集 psycopg2-binary 使用缓存的 psycopg2-binary-2.8.6.tar.gz (384 kB) 错误:命令错误退出状态 1:命令: 'c:\python39\python.exe' -c '导入系统,setuptools,tokenize;sys.argv[0] = '"'"'C:\Users\UserName\AppData\Local\Temp\pip-install-e12d1gsx\psycopg2-binary\setup.py'"'"'; file ='"'"'C:\Users\UserName\AppData\Local\Temp\pip-install-e12d1gsx\psycopg2-binary\setup.py'"'"';f=getattr(tokenize, '"'"' open'"'"', open)( file );code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'", '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\UserName\AppData\Local\Temp\pip-pip-egg-info-bs6x9b8l' cwd: C:\ Users\UserName\AppData\Local\Temp\pip-install-e12d1gsx\psycopg2-binary
完整输出(23 行):运行 egg_info 创建 C:\Users\UserName\AppData\Local\Temp\pip-pip-egg-info- bs6x9b8l\psycopg2_binary.egg-info 写入 C:\Users\UserName\AppData\Local\Temp\pip-pip-egg-info-bs6x9b8l\psycopg2_binary.egg-info\PKG-INFO 将 dependency_links 写入 C:\Users\UserName\ AppData\Local\Temp\pip-pip-egg-info-bs6x9b8l\psycopg2_binary.egg-info\dependency_links.txt
将顶级名称写入 C:\Users\UserName\AppData\Local\Temp\pip-pip-egg- info-bs6x9b8l\psycopg2_binary.egg-info\top_level.txt 写入清单文件'C:\Users\UserName\AppData\Local\Temp\pip-pip-egg-info-bs6x9b8l\psycopg2_binary.egg-info\SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
----------------------------------------
错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。
解决方案
推荐阅读
- c# - 您如何以统一的帧速率移动?
- c# - EntityFrameworkCore.SqlServer:无法使用自定义模型类映射数据库表
- vb.net - 当我在代码中没有发现任何错误时,Windows 服务启动然后停止
- javascript - 在从远程设备访问的角度应用程序调用的节点 api 上获取 ERR_CONNECTION_REFUSED
- apache-kafka - 关于 kafka 连接失败的 kafka-streams 警报
- react-native - React-Native:如何绘制具有随机边数的形状(边数将是用户输入值)?
- node.js - 如何在views文件夹中的nestjs应用程序中的hbs模板引擎中设置html模板
- python - 小应用程序在 virtualenv 中的桌面上运行,但在 Heroku 上间歇性失败
- ios - Objective C中的单元测试类参考问题
- javascript - 如何在函数中调用函数?