简体   繁体   中英

Getting Error while installing psycopg2 in windows

Hi I am working on a Django project and I am getting errors while installing psycopg2 on windows

pip install psycopg2

I also tried

pip install psycopg2-binary

but still getting error

ERROR: Command errored out with exit status 1:
 command: 'c:\users\theuser\appdata\local\programs\python\python39\python.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('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\theuser\AppData\Local\Temp\pip-pip-egg-info-upmu4r_j'
     cwd: C:\Users\theuser\AppData\Local\Temp\pip-install-zh83zqbg\psycopg2\
Complete output (23 lines):
running egg_info
creating C:\Users\theuser\AppData\Local\Temp\pip-pip-egg-info-upmu4r_j\psycopg2.egg-info
writing C:\Users\theuser\AppData\Local\Temp\pip-pip-egg-info-upmu4r_j\psycopg2.egg-info\PKG-INFO
writing dependency_links to C:\Users\theuser\AppData\Local\Temp\pip-pip-egg-info-upmu4r_j\psycopg2.egg-info\dependency_links.txt
writing top-level names to C:\Users\theuser\AppData\Local\Temp\pip-pip-egg-info-upmu4r_j\psycopg2.egg-info\top_level.txt
writing manifest file 'C:\Users\theuser\AppData\Local\Temp\pip-pip-egg-info-upmu4r_j\psycopg2.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>).

----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

The key is this:

Error: pg_config executable not found.

Either you didn't install the development tools ( pg_config belongs to them), or the directory where the executable is installed is not in your PATH environment variable.

你没有在 Windows 上安装 postgres

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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