Reputation: 38677
I am install psycopg2 in the CentOS 7.9 using this command:
pip3.9 install psycopg2
but shows error like this:
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qpjxu3uz/psycopg2_009102b415df471f9b4808adbcda990c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qpjxu3uz/psycopg2_009102b415df471f9b4808adbcda990c/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 /tmp/pip-pip-egg-info-prsk3_f3
cwd: /tmp/pip-install-qpjxu3uz/psycopg2_009102b415df471f9b4808adbcda990c/
Complete output (16 lines):
/usr/local/lib/python3.9/site-packages/setuptools/dist.py:642: UserWarning: Usage of dash-separated 'index-url' will not be supported in future versions. Please use the underscore name 'index_url' instead
warnings.warn(
running egg_info
creating /tmp/pip-pip-egg-info-prsk3_f3/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-prsk3_f3/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-prsk3_f3/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-prsk3_f3/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-prsk3_f3/psycopg2.egg-info/SOURCES.txt'
Error: pg_config executable not found.
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'.
----------------------------------------
I have already install postgresql13-devel using command dnf install postgresql13-devel -y
and install successs. why still could not install the psycopg2?
Upvotes: 0
Views: 2377
Reputation: 205
2023 on Mac M1 when trying to setup a Postgres instance for my Django app. This is how I installed it.
python3 -m pip install psycopg2-binary
Upvotes: 1
Reputation: 38677
add the pg_config
path to the system execute search path, for example, my PostgreSQL was installed in the path /opt/pg13
, so export the path like this would fix this problem:
export PATH=/opt/pg13/bin:$PATH
Upvotes: 2