pg宝石很顽固,所以我无法在新计算机上加载我的应用程序。似乎有多个问题,无法找到pg_config,然后找到extconf.rb
#psql working...
psql (9.2.1)
Type "help" for help.
nd =>
\q
$ pg_config:
#adding the path to bashrc...
$ nano .bashrc
PATH=/usr/pgsql-9.2/bin:$PATH
#seems to work...
pg_config: /usr/pgsql-9.2/bin/pg_config
$ sudo gem install pg
#but i get the same errors...
Building native extensions. This could take a while...
.......
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/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.
有没有处理过此问题的Linux人员?
此问题的解决方法
$ yum install /usr/include/libpq-fe.h
对于Fedora 20+,需要以下软件包:
sudo yum install postgresql-devel
〜嗨
我在Rails项目中安装gem“ pg”时遇到了相同的问题,当运行命令“ bundle install”时出现了相同的错误,在我的情况下partiuclar可以如下解决:]
我使用Fedora 19,我想它可以用Fedora 17中的相同方法解决:
我使用以下教程安装了Postgres:
然后,我在〜/ .bashrc中添加了下一行,以解决pg_config的问题:
PATH = / usr/pgsql-9.2/bin: $ PATH
最后解决libpq-fe.h的问题,我按如下所示安装了postgresql-devel:
# yum install postgresql92-devel
最后在我的Rails项目中,运行命令“捆绑安装”,并且没有其他错误。
对于fedora 30: