本文主要是介绍ubuntu 12.04 安装 boost 失败,have unmet dependencies,held broken packages 问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1. 问题
$ sudo apt-get install libboost-all-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:libboost-all-dev : Depends: libboost-iostreams-dev but it is not going to be installedDepends: libboost-python-dev but it is not going to be installedDepends: libboost-regex-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
2. 解决方法
查看 hold packages
$ dpkg --get-selections | grep hold
如果没有,使用 aptitude 安装
$ sudo apt-get install aptitude
$ sudo aptitude install libboost-all-dev
3. aptitude vs apt-get
http://askubuntu.com/questions/1743/is-aptitude-still-considered-superior-to-apt-get
参考:
http://askubuntu.com/questions/223237/unable-to-correct-problems-you-have-held-broken-packages
http://superuser.com/questions/428033/why-use-the-command-apt-get-purge-remove-over-apt-get-purge-in-linux
http://www.linuxquestions.org/questions/ubuntu-63/how-to-fix-broken-package-904637/
之后在装 vim-gnome 时,又碰到 have unmet dependencies,held broken packages 问题。用 aptitude 装则选项太多,不是很有把握。以前 apt-get 也没碰到这么多 broken packages 的问题阿,干脆怀疑是不是系统出了啥问题?是不是之前装 ark(使用kde)时装的kde依赖与gnome有版本冲突。
于是卸了 ark 和 kde 依赖,最后还是不行。于是想查是不是有 broken package,但 dpkg --get-selections | grep hold 并没有输出。我又怀疑这个工具是不是不能较好的显示 broken package,于是又装了 synaptic 包管理,结果里面依然没有 broken package。
用 sudo apt-get update 时会出现,Failed to fetch http://ppa.launchpad.net/shawn-p-huang/ppa/ubuntu/dists/precise/main/source/Sources 404 Not Found 的 error,于是在 /etc/apt/sources.list.d 目录里删掉这些ppa,再 update 成功,再装 vim-gnome 还是失败。
最后想是不是默认源有问题,索性换成 163 的源,再 update,再装,就成功了。
这篇关于ubuntu 12.04 安装 boost 失败,have unmet dependencies,held broken packages 问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!