不知道 pg_config 是什么,我在網上搜索,它似乎是 PostgreSQL 的一部分或連接到 PostgreSQL。我沒有或使用過,也從未使用過,但我懷疑我可能會得到這個,因為我最近開始在 Python 中使用 azure 庫(我以前從未遇到過這個問題)。這是錯誤訊息之一:
WARNING: Discarding https://files.pythonhosted.org/packages/aa/8a/7c80e7e44fb1b4277e89bd9ca509aefdd4dd1b2c547c6f293afe9f7ffd04/psycopg2-2.9.1.tar.gz#sha256=de5303a6f1d0a7a34b9d40e4d3bef684ccc44a49bbe3eb85e3c0bffb4a131b7c (from https://pypi.org/simple/psycopg2/) (requires-python:>=3.6). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached psycopg2-2.9.tar.gz (379 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\E\AppData\Local\Programs\Python\Python310\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\E\\AppData\\Local\\Temp\\pip-install-q50_w0n5\\psycopg2_b3e7f5e155154965bfc0d5340d85b1ff\\setup.py'"'"'; __file__='"'"'C:\\Users\\E\\AppData\\Local\\Temp\\pip-install-q50_w0n5\\psycopg2_b3e7f5e155154965bfc0d5340d85b1ff\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\E\AppData\Local\Temp\pip-pip-egg-info-ufqtnd89'
cwd: C:\Users\E\AppData\Local\Temp\pip-install-q50_w0n5\psycopg2_b3e7f5e155154965bfc0d5340d85b1ff\
Complete output (23 lines):
running egg_info
creating C:\Users\E\AppData\Local\Temp\pip-pip-egg-info-ufqtnd89\psycopg2.egg-info
writing C:\Users\E\AppData\Local\Temp\pip-pip-egg-info-ufqtnd89\psycopg2.egg-info\PKG-INFO
writing dependency_links to C:\Users\E\AppData\Local\Temp\pip-pip-egg-info-ufqtnd89\psycopg2.egg-info\dependency_links.txt
writing top-level names to C:\Users\E\AppData\Local\Temp\pip-pip-egg-info-ufqtnd89\psycopg2.egg-info\top_level.txt
writing manifest file 'C:\Users\E\AppData\Local\Temp\pip-pip-egg-info-ufqtnd89\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>).
似乎問題不在于路徑,而在于我根本沒有 pg_config 。在線搜索沒有幫助;我發現的建議是:
- 升級點
- brew install postgresql(似乎只適用于macs???)
- pip 安裝 psycopg2-binary
- 運行 which pg_config 運行
- whereis pg_config(也試過where)
它都沒有奏效。任何以 pg_config 開頭的命令都表示它是一個無法識別的命令。
uj5u.com熱心網友回復:
安裝 PostgreSQL。從包安裝時,請確保安裝包含pg_config、PGXS 和 C 頭檔案的開發包。
您可能需要將 PostgreSQL 二進制目錄放在PATH:
export PATH=/usr/pgsql-14/bin:$PATH
(當然你必須使用正確的路徑。)
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/334922.html
標籤:Python 姜戈 PostgreSQL 天蓝色 配置文件
