当我运行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-context-dev but it is not going to be installed
Depends: libboost-coroutine-dev but it is not going to be installed
Depends: libboost-exception-dev but it is not going to be installed
Depends: libboost-graph-dev but it is not going to be installed
Depends: libboost-graph-parallel-dev but it is not going to be installed
Depends: libboost-locale-dev but it is not going to be installed
Depends: libboost-log-dev but it is not going to be installed
Depends: libboost-math-dev but it is not going to be installed
Depends: libboost-mpi-dev but it is not going to be installed
Depends: libboost-mpi-python-dev but it is not going to be installed
Depends: libboost-random-dev but it is not going to be installed
Depends: libboost-signals-dev but it is not going to be installed
Depends: libboost-timer-dev but it is not going to be installed
Depends: libboost-wave-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
在深入挖掘并尝试单独安装依赖项后,我首先尝试了sudo apt-get install libboost-context-dev
,它提示我安装libboost-context1.54-dev
,结果出现错误
libboost-context1.54-dev : Depends: libboost1.54-dev (= 1.54.0-4ubuntu3) but 1.54.0-4ubuntu3.1 is to be installed
在我看来,依赖项要求的版本与我的系统上通过apt-get可用的版本不同,但我不太确定这里发生了什么。
可能重复:在ubuntu core 14.04上安装libboost-all-dev时依赖失败
我刚刚遇到了完全相同的包的问题,但这是一个反复出现的问题。我使用以下方法解决了这个问题(安装libboost-all-dev
)。这有点乏味,但在大约5到10分钟内(取决于依赖项的数量)就能工作得很好。事实上,你几乎已经找到了解决方案。
对于未满足依赖项列表中的每个包,您必须遵循该依赖项,直到找到无法安装的包,因为它有另一个最新的包可用。然后使用=
和apt-get
符号强制将其安装在降级版本中。例如:
apt-get install libboost1.54-dev=1.54.0-4ubuntu3
一旦你完成了所有的依赖,你就可以安装你的主包(libboost-all-dev
)。
我不知道是否有更好(更快)的方法来做这件事。