无法在 ubuntu 14.04 中安装 libpq-dev

无法在 ubuntu 14.04 中安装 libpq-dev

我无法为 postgresql 安装 libpq-dev,我试过了

sudo apt-get install libpq-dev

和输出

Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libpq-dev : Depends: libpq5 (= 9.3.9-0ubuntu0.14.04) but 9.4.4-1.pgdg14.04+1 is to be installed
E: Unable to correct problems, you have held broken packages.

如何解决这个问题?

答案1

问题解决了!

我通过 remove 解决了这个问题libpq5

sudo apt-get remove libpq5
sudo apt-get install libpq-dev

答案2

为了修复这个问题,我必须添加 postgresql 的 repo:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get -y update
sudo apt-get remove libpq5
sudo apt-get install libpq-dev

答案3

可以通过以下步骤解决该问题:

sudo apt-get update
sudo apt-get remove libpq5
sudo apt-get install libpq-dev

相关内容