繁体   English   中英

无法在 ubuntu 20.04 中安装 g++

[英]Unable to install g++ in ubuntu 20.04

我在这个网站上看到了一些类似的问题old latest
但他们都没有得到回答,我无法在那里发表评论,因为我的声誉点较少。

当我运行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++。

谢谢您的帮助!

我通过首先安装aptitude找到了解决方法。
我按照以下步骤操作:

sudo apt-get install aptitude
然后 aptitude 给出一个包列表(没有安装)
并要求将这些软件包保持在同一版本中。 选择否 ( n )。
然后 aptitude 要求降级一些软件包。 选择是 ( Y )。

最后运行命令: sudo aptitude install build-essential

运行上述命令后, g++已经安装好了,我不需要单独安装它。\

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM