无法在Centos上安装PG ruby​​gem

我正试图在我的Centos VPS上运行gem install pg ,但是我得到了

 Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb checking for pg_config... no No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby --with-pg --without-pg --with-pg-config --without-pg-config --with-pg_config --without-pg_config --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/ 

我已经安装了postgres 9.3,你可以在这里看到( yum list installed | grep postgres

 postgresql-libs.x86_64 8.4.13-1.el6_3 @base postgresql93.x86_64 9.3.1-1PGDG.rhel6 @pgdg93 postgresql93-devel.x86_64 9.3.1-1PGDG.rhel6 @pgdg93 postgresql93-libs.x86_64 9.3.1-1PGDG.rhel6 @pgdg93 postgresql93-server.x86_64 9.3.1-1PGDG.rhel6 @pgdg93 

您可以使用yum安装postgresql库:

 yum install postgresql-libs 

这应该安装引用的库,所以你可以尝试再次安装gem。

尝试此解决scheme并重新启动会话

 export PATH="/usr/pgsql-9.3/bin:$PATH" 

或尝试

 yum install libpqxx-devel gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config