ruby-on-rails - 您持有破损的包裹 - 用于 Rails 的 Postgres gem

标签 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 存储库。我做了一个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

关于ruby-on-rails - 您持有破损的包裹 - 用于 Rails 的 Postgres gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25393203/

相关文章:

sql - PostgreSQL - 优化查询性能

ruby-on-rails - rails 小号 : undefined method `symbolize_keys'

css - 除了给宽度 100% 之外,如何设置标题或正文内容的最大宽度

ruby-on-rails - 这些错误消息是什么意思?

ruby - 如何在 CentOS 6.9 上安装 Ruby?

ruby-on-rails - 在 Ruby 中验证电子邮件地址的最佳/简单方法是什么?

ruby-on-rails - 按子域过滤 ruby​​ on rails 中的数据

javascript - 如何保存拖动标记的新定位?

java - 使用 JDBC 连接到 postgres 时是否可以指定架构?

postgresql - 如何使用postgresql角色连接数据库?