在windows中安装psycopg2时出错



嗨,我正在处理Django项目,在windows 上安装psycopg2时出错

pip install psycopg2

我也试过

pip install psycopg2-binary

但是仍然得到错误

ERROR: Command errored out with exit status 1:
command: 'c:userstheuserappdatalocalprogramspythonpython39python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\theuser\AppData\Local\Temp\pip-install-zh83zqbg\psycopg2\setup.py'"'"'; __file__='"'"'C:\Users\theuser\AppData\Local\Temp\pip-install-zh83zqbg\psycopg2\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:UserstheuserAppDataLocalTemppip-pip-egg-info-upmu4r_j'
cwd: C:UserstheuserAppDataLocalTemppip-install-zh83zqbgpsycopg2
Complete output (23 lines):
running egg_info
creating C:UserstheuserAppDataLocalTemppip-pip-egg-info-upmu4r_jpsycopg2.egg-info
writing C:UserstheuserAppDataLocalTemppip-pip-egg-info-upmu4r_jpsycopg2.egg-infoPKG-INFO
writing dependency_links to C:UserstheuserAppDataLocalTemppip-pip-egg-info-upmu4r_jpsycopg2.egg-infodependency_links.txt
writing top-level names to C:UserstheuserAppDataLocalTemppip-pip-egg-info-upmu4r_jpsycopg2.egg-infotop_level.txt
writing manifest file 'C:UserstheuserAppDataLocalTemppip-pip-egg-info-upmu4r_jpsycopg2.egg-infoSOURCES.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>).
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

关键是:

Error: pg_config executable not found.

或者您没有安装开发工具(pg_config属于它们(,或者安装可执行文件的目录不在PATH环境变量中。

您没有在windows 上安装postgres

最新更新