Ruby on rails 为Heroku安装PostgreSQL gem pq

Ruby on rails 为Heroku安装PostgreSQL gem pq,ruby-on-rails,ruby,postgresql,heroku,railstutorial.org,Ruby On Rails,Ruby,Postgresql,Heroku,Railstutorial.org,第一个问题,但我现在要非常感谢你们,因为stackoverflow在迈克尔·哈特尔·图坦卡蒙的第一章中帮助了我将近15次 现在,我尝试使用以下命令安装PostgreSQL(pg gem): ` 但它显示了一个错误 -bash: group: command not found 然后我试着直接安装(?)gem gem install pg 但它显示了另一个错误 `Fetching: pg-0.17.1.gem (100%) Building native extensions. Th

第一个问题,但我现在要非常感谢你们,因为stackoverflow在迈克尔·哈特尔·图坦卡蒙的第一章中帮助了我将近15次

现在,我尝试使用以下命令安装PostgreSQL(pg gem):

`

但它显示了一个错误

-bash: group: command not found
然后我试着直接安装(?)gem

gem install pg
但它显示了另一个错误

`Fetching: pg-0.17.1.gem (100%) 



Building native extensions.  This could take a while... 




 ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.



rvm/rubies/ruby-2.0.0-p353/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=/Users/trabalho/.rvm/rubies/ruby-2.0.0-p353/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}/

extconf failed, exit code 1

Gem files will remain installed in .rvm/gems/ruby-2.0.0-p353@railstutorial_rails_4_0/gems/pg-0.17.1 for inspection.
Results logged to .rvm/gems/ruby-2.0.0-p353@railstutorial_rails_4_0/extensions/x86_64-darwin-10/2.0.0/pg-0.17.1/gem_make.out`
我不知道是否安装了,也不知道如何确认。如何使group命令工作?或者如何安装gem pg和rails\u 12factor?
有什么帮助吗?

您不希望从终端以命令的形式运行
group…
,而是将该代码块放在rails应用程序的
Gemfile

Gemfile

group :production do 
  gem 'pg', '0.15.1'
  gem 'rails_12factor', '0.0.2'
end
然后运行
bundle
命令


如果您仍然无法以这种方式编译
pg
gem,那么您需要确保安装了xcode命令行工具(假设您使用的是OSX)。要安装这些,只需从终端运行
xcode选择--install
,并按照提示进行操作。

您正在运行ubuntu吗?看起来您需要此库:

sudo apt-get install libpq-dev


它在Ubuntu上帮助了我

我没有使用UBTO,我使用的是OSX 10.6。苏多做什么?啊。然后看起来您需要命令行工具。要安装它们:
xcode选择--install
;然后再试一次
sudo
以超级用户权限运行命令,并且需要管理密码。我是Ubuntu用户,它为我工作,非常感谢!
sudo apt-get install libpq-dev
sudo apt-get install libpq-dev