Ruby on rails 我无法将rails应用程序推送到Heroku/获取';pg';要安装gem吗?

Ruby on rails 我无法将rails应用程序推送到Heroku/获取';pg';要安装gem吗?,ruby-on-rails,ruby,postgresql,heroku,deployment,Ruby On Rails,Ruby,Postgresql,Heroku,Deployment,最初我无法将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_conf

最初我无法将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安装pg-v“0.17.1”-带pg配置

我在终端中遇到此错误:

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安装pg
bundle


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

ubuntu,这是一个活的USB,如果这有区别的话。你有安装postgress吗?没有,我想这就是我要做的。所以我需要一些与安装的gem不同的东西?是的:)请参阅答案这对部署有效,但现在我的服务器不工作,但我想这是另一个问题