我无法将我的rails应用程序推送到Heroku /获取’pg’gem安装?

最初我无法将我的rails 4应用程序推送到heroku因为我的数据库是sqlite,所以现在我一直在尝试安装Postgresql gem(’pg’),但我没有运气。 这是我在运行bundle install后在终端中收到的错误消息:

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 *** 

跑完之后
gem install pg -v’0.17.1′–with-pg-config

我在终端中收到此错误:

 ERROR: While executing gem ... (Gem::Requirement::BadRequirementError) Illformed requirement ["0.17.1--with-pg_config"] /project$ gem install pg -v '0.17.1'--with-pg-config ERROR: Could not find a valid gem 'pg' (= 0.17.1.pre..pre.with.pre.pg.pre.config) in any repository ERROR: Possible alternatives: pg 

谢谢您的帮助。

如果你没有安装postgres ,你可能想要:

 sudo apt-get install postgresql sudo apt-get install libpq-dev 

以下是gem install pgbundle

如果您确实安装了postgres并且运行gem install pg不起作用,则必须运行which pg_config来获取which pg_config的路径,然后运行gem install pg -- --with-pg-config= output_from_previous_command