簡體   English   中英

我正在嘗試在 Windows 中安裝 psycopg2 並出現錯誤

[英]I am trying to install psycopg2 in windows and getting error

我正在執行以下命令,它對 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.

也許這會有所幫助(pip install psycopg2)。 據我了解,有一種答案( 找不到 pg_config 可執行文件)。也許我錯了(99% 的保證,我錯了,只是因為我是編程新手)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM