【pip install psycopg2安装报错】Error: pg_config executable not found.
yum install postgresql-dev 解决 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 e
·
背景
在pip install psycopg2-binary 的时候报错了。错误内容如下。
Collecting psycopg2-binary
Using cached psycopg2-binary-2.8.6.tar.gz (384 kB)
ERROR: Command errored out with exit status 1:
command: 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bkabu6av/psycopg2-binary/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bkabu6av/psycopg2-binary/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 /tmp/pip-pip-egg-info-ez6k71_8s
cwd: /tmp/pip-install-bkabu6av/psycopg2-binary/
Complete output (23 lines):
running egg_info
creating /tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.egg-info
writing /tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.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.
原因分析
从报错的提示来看,是系统不知道pg_config的路径,需要把这个路径添加到PATH当中。但我们并不能找到这个路径在哪。那么我们就前往官网看看
但我的系统里面并不能找到这个包。而是另外一个包 postgresql-devel
解决办法
yum install postgresql-devel
更多推荐
所有评论(0)