postgresql 在没有 yum 的 CentOS 5.5 中安装 pg_config

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9600111/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-20 23:42:32  来源:igfitidea点击:

install pg_config in CentOS 5.5 without yum

postgresqlcentos

提问by Milen A. Radev

python version 2.4

蟒蛇版本 2.4

# pip install psycopg2

# pip 安装 psycopg2

Getting the following error:

得到以下错误:

Downloading/unpacking psycopg2 Running setup.py egg_info for package psycopg2

下载/解包 psycopg2 为包 psycopg2 运行 setup.py egg_info

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'.
Complete output from command python setup.py egg_info:
running egg_info

 writing pip-egg-info/psycopg2.egg-info/PKG-INFO
 writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
 writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
 warning: manifest_maker: standard file '-c' not found

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'.
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /root/sources/build/psycopg2
Storing complete log in /root/.pip/pip.log
[root@host sources]# which pg_config
/usr/bin/which: no pg_config in     (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/b    in:/root/bin)

I am unable to install pg_config as an executable

我无法将 pg_config 安装为可执行文件

回答by Milen A. Radev

You need to install postgresql-develpackage.

你需要安装postgresql-devel包。

Or build Postgres from source and then you'll have pg_confignot from a package.

或者从源代码构建 Postgres,然后您就pg_config不会从包中构建。

回答by Eden

For AWS linux (or RedHat for that matter) use:

对于 AWS linux(或 RedHat),请使用:

sudo yum install postgresql-devel

回答by owensmartin

The above answer is correct: you need to install the -develpackage. Furthermore, I found via this commentthat you then might need to manually specify where to look for pg_configto build psycopg2.

上面的答案是正确的:您需要安装-devel软件包。此外,我通过此评论发现,您可能需要手动指定在何处寻找pg_configbuild psycopg2

In particular, I wound up running

特别是,我结束了跑步

python2.7 setup.py build_ext --pg-config /usr/pgsql-9.3/bin/pg_config install

Note that this path will depend on your postgres version.

请注意,此路径将取决于您的 postgres 版本。