安装gcc时遇到了下面的问题,网上查了找到的都说什么aptitude,全是复制粘贴的帖子。
(base) dyw@ubuntu:~/$ sudo apt install gcc
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:
gcc : Depends: gcc (>= 7) but it is not going to be installed
Depends: g++ (>= 7) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
真实的解决方案:不要在ubuntu的GUI中设置apt源,而且不同版本的源也不一样!!
例如我是18.04的ubuntu,在gui中设置的阿里源就报这个错,手动更改source.list进行更改,设置为18.04的源,然后upgrade和update就解决了!!