ubuntu 12.04 安装 boost 失败,have unmet dependencies,held broken packages 问题

本文解决Ubuntu系统中使用sudo apt-get install libboost-all-dev时出现的依赖未满足错误,通过使用aptitude安装补丁,并排除系统源问题,最终成功安装vim-gnome。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 installed
                    Depends: libboost-python-dev but it is not going to be installed
                    Depends: 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,再装,就成功了。




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值