4

我正在尝试使用新的 rails 应用程序安装 pg gem,但我一直收到相同的错误:

Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

        /home/arthur/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb --with-pg-lib=/usr/lib
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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.

我已经尝试了这个问题的所有内容:如何在 Ubuntu 上安装 PostgreSQL 的 pg gem? 但没有什么对我真正有用。

顺便说一下,那是 ruby​​ 1.9.2 和 Rails 3.2。

谢谢

4

1 回答 1

1

安装 postgresql 9,然后安装你的 gem。

sudo apt-get install postgresql libpq-dev

现在,运行

gem install pg

接着

捆绑安装

于 2013-04-15T10:36:07.090 回答