我正在尝试在Windows中安装psycopg2并出现错误

时间:2020-10-26 16:31:28

标签: python

我正在执行以下命令,并且对于psycopg2-binary显示相同的命令

(demo) C:\Users\Lenovo\Desktop\Django>pip install psycopg2
Collecting psycopg2
  Using cached psycopg2-2.8.6.tar.gz (383 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\lenovo\desktop\django\demo\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-pq1_j08j\\psycopg2\\setup.py'"'"'; __file__='"'"'C:\\Users\\Lenovo\\AppData\\Local\\Temp\\pip-install-pq1_j08j\\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\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5'
         cwd: C:\Users\Lenovo\AppData\Local\Temp\pip-install-pq1_j08j\psycopg2\
    Complete output (23 lines):
    running egg_info
    creating C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\psycopg2.egg-info
    writing C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\psycopg2.egg-info\PKG-INFO
    writing dependency_links to C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\psycopg2.egg-info\dependency_links.txt
    writing top-level names to C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\psycopg2.egg-info\top_level.txt
    writing manifest file 'C:\Users\Lenovo\AppData\Local\Temp\pip-pip-egg-info-a33qt0v5\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.

1 个答案:

答案 0 :(得分:0)

也许这会有所帮助(pip install psycopg2)。据我了解,有一个答案(pg_config executable not found)。也许我错了(99%的保证,我错了,只是因为我是编程新手)。

相关问题