【发布时间】:2020-09-26 12:31:15
【问题描述】:
我需要安装 psycopg2 来连接 postgresql 和 django。我试过这个命令。
pip install psycopg2
但是显示了这条消息:
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>).
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Rafid\AppData\Local\Temp\pip-install-oknhhl43\psycopg2\
我是网络开发的新手,所以详细的解决方案会很有帮助...提前致谢
【问题讨论】:
-
这能回答你的问题吗? pg_config executable not found
-
使用 Parvathirajan Natarajan 的回答,因为错误消息指出:“如果您不想从源代码构建 psycopg2,请改为安装 PyPI 'psycopg2-binary' 包。”
标签: python django postgresql web web-applications