提问人: 提问时间:5/31/2022 更新时间:5/31/2022 访问量:3820
无法在 ubuntu 20.04 中安装 g++
Unable to install g++ in ubuntu 20.04
问:
我在这个网站上看到了一些类似的问题。
但是他们都没有得到答复,我无法在那里发表评论,因为我的声望点数较少。
当我运行时,我收到以下错误:sudo apt install g++
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: gcc (= 4:9.3.0-1ubuntu2) but it is not going to be installed
Depends: g++-9 (>= 9.3.0-3~) but it is not going to be installed
Depends: gcc-9 (>= 9.3.0-3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
当我运行时,我收到以下错误:sudo apt install build-essential
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:
build-essential : Depends: gcc (>= 4:9.2) but it is not going to be installed
Depends: g++ (>= 4:9.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我需要在 ubuntu20.04 中安装 g++。
感谢您的帮助!
答:
2赞
user17098578
5/31/2022
#1
我通过先安装找到了解决方法。
我按照以下步骤操作:aptitude
sudo apt-get install aptitude
然后 aptitude 给出一个软件包列表(没有一个安装),
并要求将这些软件包保留在同一版本中。选择“否”()。
然后 aptitude 要求降级一些软件包。选择“是”()。n
Y
最后运行命令:sudo aptitude install build-essential
运行上述命令后已经安装,我不需要单独安装它。g++
评论
apt update
apt update
All packages are up to date.
aptitude
sudo apt install g++ gcc