当你想安装某个软件时,报依赖的版本错误
E: Unable to correct problems, you have held broken packages
这种问题有多种情况,我这里只说一种:
你想安装的软件所需要的依赖项你的系统已经安装了,但是你系统已经安装的依赖项版本与它想要的版本不一致导致的
比如我想安装sphinx-common
sudo apt-get install sphinx-common
报错:
The following packages have unmet dependencies: sphinx-common :
Depends: libjs-sphinxdoc (= 1.3.6-2ubuntu1) but 1.3.6-2ubuntu1.2 is to
be installed Recommends: python-sphinx but it is not going to be
installed or python3-sphinx but it is not going to be installed E:
Unable to correct problems, you have held broken packages
分析:
它想要的依赖项和版本是 libjs-sphinxdoc和1.3.6-2ubuntu1,但是我系统已经安装的是 1.3.6-2ubuntu1.2 版本。
所以解决办法就是安装指定版本的依赖项就可以了,要在平时的安装命令后面加上 =版本号
sudo apt-get install libjs-sphinxdoc=1.3.6-2ubuntu1