你已经拿破了包裹 - Postgres gem for rails

时间:2014-08-19 21:23:19

标签: ruby-on-rails ruby postgresql ubuntu

因此,当我尝试进行捆绑安装时,我被告知要确保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-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y 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?

2 个答案:

答案 0 :(得分:0)

我遇到了这个问题。我在这里找到了解决方案: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

答案 1 :(得分:0)

在尝试了多种解决方案后,我遇到了同样的问题

以下软件包具有未满足的依赖性:

but it is not going to be installed
           Depends: libwxbase3.0-0v5 (>= 3.0.4+dfsg)  
but it is not installable
           Depends: ```libwxgtk3.0-0v5 (>= 3.0.4+dfsg)  
but it is not installable
 E: Unable to correct problems, you have held broken packages.

上述解决方法是卸载Postgresql和pgAdmin并从官方网站下载

https://www.postgresql.org/

https://www.pgadmin.org/download/pgadmin-4-apt/