你已经拿破了包 – Postgres gem for rails

因此,当我尝试进行捆绑安装时,我被告知确保pg gem已成功安装,因此当我执行gem install pg vx.xx我得到:

 Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /home/adam/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config You need to install postgresql-server-dev-XY for building a server-side extension or libpq-dev for building a client-side application. You need to install postgresql-server-dev-XY for building a server-side extension or libpq-dev for building a client-side application. checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** extconf.rb failed *** 

那么我做:

 sudo apt-get install libpq-dev 

但我明白了

 The following packages have unmet dependencies: libpq-dev : Depends: libpq5 (= 9.1.14-0ubuntu0.12.04) but 9.3.5-1.pgdg12.4+1 is to be installed E: Unable to correct problems, you have held broken packages. 

所以我有从postgres和pgadmin安装的其他所有内容的9.1,我有任何9.3 repos禁用。 我做了一个sudo apt-get update但我认为错误非常明显。 那么如何让它不尝试安装9.3.5 ….并使用9.1.14?

我刚遇到这个问题。 我在这里找到了解决方案: http : //blog.andrewbeacock.com/2007/03/how-to-install-specific-version-of.html

实质上:

 $: apt-get install libpq5=9.1.14-0ubuntu0.12.04 $: apt-get install libpq-dev=9.1.14-0ubuntu0.12.04 $: apt-get install postgresql-server-dev-9.1