我在 Ubuntu 16.04.01 上遇到了一个相当标准的“但它不会被安装”错误。例如:
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: krb5-multidev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
因此让我们继续自己安装:
sudo apt-get install libpq-dev krb5-multidev
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:
krb5-multidev : Depends: libkrb5-3 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
Depends: libk5crypto3 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
Depends: libgssapi-krb5-2 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
让我们继续:
sudo apt-get install libpq-dev krb5-multidev libkrb5-3 libk5crypto3 libgssapi-krb5-2
Reading package lists... Done
Building dependency tree
Reading state information... Done
libk5crypto3 is already the newest version (1.13.2+dfsg-5ubuntu2).
libk5crypto3 set to manually installed.
libgssapi-krb5-2 is already the newest version (1.13.2+dfsg-5ubuntu2).
libgssapi-krb5-2 set to manually installed.
libkrb5-3 is already the newest version (1.13.2+dfsg-5ubuntu2).
libkrb5-3 set to manually installed.
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:
krb5-multidev : Depends: libkrb5-3 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
Depends: libk5crypto3 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
Depends: libgssapi-krb5-2 (= 1.13.2+dfsg-5) but 1.13.2+dfsg-5ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
你可以一遍又一遍地继续下去,直到你厌倦并停止。
/etc/apt/sources.list
:
deb http://archive.ubuntu.com/ubuntu xenial main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu trusty main restricted #Added by software-properties
我尝试过更新我sources.list
的software-properties
,并且尝试了所有方法这里解决它却无济于事。
答案1
我通过安装解决了这个问题资质:sudo aptitude install libpq-dev
降级了 3 个软件包:
libk5crypto3
libgssapi-krb5-2
libkrb5-3
我无法理解为什么我应该降级apt-get
。
答案2
我遇到了其他类似的问题,只是说“依赖但无法安装”和“您持有损坏的软件包”。我尝试了易于那里列出的方法,update
或者upgrade
或--fix-broken
。但最后我发现的是使用sudo apt-get install [broken package]
,这当然不会成功,但会给你一个无法安装的软件包列表,我最后发现软件包的一些依赖项已经安装在我的服务器上,但版本较高,但软件包依赖于其依赖项的一些较低版本,所以只需sudo apt-get install [conflicted package]=[desired version]
解决这个问题。如果你解决了你的问题,下次你可以尝试一下。
答案3
我最初不明白终端给出的消息,但运行
sudo apt --fix-broken install
解决了我的问题。我最初在命令末尾使用包名称来运行此命令,但它不需要额外的参数。