在没有yum的情况下在CentOS 5.5中安装pg_config

时间:2012-03-07 10:54:35

标签: postgresql centos

python版本2.4

#ppip install 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)

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

3 个答案:

答案 0 :(得分:14)

您需要安装postgresql-devel包。

或者从源代码构建Postgres,然后你就不会从包中获得pg_config

答案 1 :(得分:4)

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

SELECT * 
FROM contest_score 
order by 
   score desc, 
   CAST(time as DECIMAL(9,2)) ASC

答案 2 :(得分:1)

以上答案是正确的:您需要安装-devel包。此外,我通过this comment找到了您可能需要手动指定在哪里查找pg_config来构建psycopg2

特别是,我跑了

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

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