Ruby on rails 在Centos上安装pg gem时,Capistrano捆绑包安装失败

Ruby on rails 在Centos上安装pg gem时,Capistrano捆绑包安装失败,ruby-on-rails,postgresql,rvm,vps,Ruby On Rails,Postgresql,Rvm,Vps,我正在使用Capistrano将Rails应用程序部署到Centos VPS。在我的VPS上,我可以gem安装pg,但是当我运行cap staging deploy时,由于 An error occurred while installing pg (0.17.1), and Bundler cannot continue. DEBUG[07a4f16d] Make sure that `gem install pg -v '0.17.1'` succeeds before bundli

我正在使用Capistrano将Rails应用程序部署到Centos VPS。在我的VPS上,我可以gem安装pg,但是当我运行cap staging deploy时,由于

An error occurred while installing pg (0.17.1), and Bundler cannot continue.
DEBUG[07a4f16d]     Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
当命令'cd/var/www/projectx/releases/20141117004357&&/usr/local/rvm/bin/rvm default do bundle install--binstubs/var/www/projectx/shared/bin--path/var/www/projectx/shared/bundle--without development test--deployment--quiet'

因此,在VPS上,我可以全局安装pg gem,但当它尝试在我的发布目录cd/var/www/projectx/releases/20141117004357中运行bundle时失败了

错误:

Gem::Ext::BuildError:错误:无法生成Gem本机扩展

/usr/local/rvm/rubies/ruby-2.1.0/bin/ruby -r ./siteconf20141116-8316-zgkk04.rb extconf.rb        --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config
Using config values from /opt/local/lib/postgresql91/bin/pg_config
sh: /opt/local/lib/postgresql91/bin/pg_config: No such file or directory
sh: /opt/local/lib/postgresql91/bin/pg_config: No such file or directory
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.
它是由--with pg config=/opt/local/lib/postgresql91/bin/pg_-config引起的,我的pg_-config是一个不同的位置,我如何更改它

有什么想法吗

谢谢

这里已经回答了