我尝试了一下sudo apt-get install libpq-dev
,但出现此错误
Reading package lists... Done
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: libssl-dev but it is not going to be installed
Depends: krb5-multidev but it is not going to be installed
Depends: comerr-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我也运行了这个命令apt-cache policy libpq-dev libssl-dev krb5-multidev comerr-dev
,这是结果
libpq-dev:
Installed: (none)
Candidate: 9.3.4-1
Version table:
9.3.4-1 0
500 http://sd.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
libssl-dev:
Installed: (none)
Candidate: 1.0.1f-1ubuntu2
Version table:
1.0.1f-1ubuntu2 0
500 http://sd.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
krb5-multidev:
Installed: (none)
Candidate: 1.12+dfsg-2ubuntu4
Version table:
1.12+dfsg-2ubuntu4 0
500 http://sd.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
comerr-dev:
Installed: (none)
Candidate: 2.1-1.42.9-3ubuntu1
Version table:
2.1-1.42.9-3ubuntu1 0
500 http://sd.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
输出sudo apt-get install libssl-dev krb5-multidev comerr-dev
Reading package lists... Done
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:
comerr-dev : Depends: libcomerr2 (= 1.42.9-3ubuntu1) but 1.42.9-3ubuntu1.2 is to be installed
krb5-multidev : Depends: libkrb5-3 (= 1.12+dfsg-2ubuntu4) but 1.12+dfsg-2ubuntu5.1 is to be installed
Depends: libk5crypto3 (= 1.12+dfsg-2ubuntu4) but 1.12+dfsg-2ubuntu5.1 is to be installed
Depends: libgssapi-krb5-2 (= 1.12+dfsg-2ubuntu4) but 1.12+dfsg-2ubuntu5.1 is to be installed
libssl-dev : Depends: libssl1.0.0 (= 1.0.1f-1ubuntu2) but 1.0.1f-1ubuntu2.15 is to be installed
Recommends: libssl-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我该怎么做才能修复这个问题?
答案1
您的来源非常过时,例如当前版本,
libpq-dev-9.3.10-0ubuntu0.14.04
libssl-dev-1.0.1f-1ubuntu2.16
krb5-多设备-1.12+dfsg-2ubuntu5.2
comerr-dev -2.1-1.42.9-3ubuntu1.3
打开Software & Updates,确保在“更新”选项卡下启用了 和trusty-security
,trusty-updates
然后重新加载源并查看是否获取了当前版本。如果两者都已启用,则打开终端并运行sudo apt-get update
,然后检查当前版本。
如果这没有帮助,则再次打开软件和更新并在主页上切换到该Download from:
部分中的不同镜像,重新加载源等。
答案2
我所看到的这里在您的问题中,您(手动?)安装了一些与 Ubuntu 标准存储库中的软件包相冲突的软件包。您要安装的软件包需要依赖项的所需版本。
运行以下命令:
sudo apt-get update
sudo apt-get install libssl1.0.0=1.0.1f-1ubuntu2 ibcomerr2=1.42.9-3ubuntu1
降低他们每个人的级别。
对于其他软件包,你必须启用trusty-security
它trusty-updates
(使用从这里)。此软件包包含比已安装版本更高的版本。
sudo apt-get install git
git clone https://github.com/kos0/addRemoveDistribution.git
cd addRemoveDistribution
sudo ./enableDisableDistribution.pl enable security
sudo ./enableDisableDistribution.pl enable updates
在那之后
sudo apt-get update
sudo apt-get install libpq-dev