0
点赞
收藏
分享

微信扫一扫

E: Unable to correct problems, you have held broken packages.

elvinyang 2022-02-15 阅读 86


在Ubuntu 上安装G++不成功遇到如下错误:

ubuntu:~/IC/3.3$ sudo apt install g++
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:
g++ : Depends: g++-9 (>= 9.3.0-3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

原因:

Linux下经常需要安装不同类型的库,在Ubuntu中,这些类库都是以“lib_name-version”的形式命名的。很多库之间存在依赖关系,即要安装这个就必须安装那个。有时候,类库之间依赖关系无法满足,你所要安装的程序就不能安装。

这类问题大多是由于相互依赖的几个库中一个或多个的版本已经更新,而用户要安装的库依赖于这几个库的较低的版本,这时候可以试试使用“sudo aptitude install ”(尖括号内为你要安装的程序的名字)

方法1:

$ sudo apt-get upgrade
$ sudo apt-get update

之后就可以安装了

方法2:

​​ https://askubuntu.com/questions/223237/unable-to-correct-problems-you-have-held-broken-packages​​



举报

相关推荐

0 条评论