我得错误安装pg gem

时间:2014-02-03 12:47:11

标签: ruby-on-rails ruby rvm

我在Ubuntu 10.04上,如何修复此错误?

当我使用bundle install命令时,会安装必要的宝石,以便使用rails s运行应用。

但是“bundle install”命令也失败了。

我不理解控制台提示,有人可以帮助我吗?

antonio@antonio-desktop:~/Descargas/ecozap$ gem install pg -v 0.15.1
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.3-p484/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-1.9.3-p484/bin/ruby
    --with-pg
    --without-pg
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p484/gems/pg-0.15.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p484/extensions/x86-linux/1.9.1/pg-0.15.1/gem_make.out

当我使用sudo apt-get install libpq-dev时,我收到以下错误:

antonio @ antonio-desktop: ~ / Downloads / ECOZAP $ sudo apt-get install libpq-dev
[sudo] password for antonio: 
E: Failed to lock / var / lib / dpkg / lock - open (11: Resource temporarily unavailable) 
E: Unable to lock the administration directory (/ var / lib / dpkg /), maybe there is another process using it?

1 个答案:

答案 0 :(得分:0)

您所要做的就是关闭任何其他锁定apt的包管理器并重新安装libpq-dev。