gcc : Depends: cpp (= 4:9.3.0-1ubuntu2) but it is not going to be installed g++ : Depends: cpp (= 4:9.3.0-1ubuntu2) but it is not going to be installed

问题

apt install build-essential
Reading package lists... Done
Building dependency tree... Done
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: cpp (= 4:9.3.0-1ubuntu2) but it is not going to be installed
 gcc : Depends: cpp (= 4:9.3.0-1ubuntu2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

解决

sudo apt-get clean
sudo apt update
sudo apt -f install
sudo apt install build-essential
sudo apt-mark showhold
sudo apt install cpp=4:9.3.0-1ubuntu2

apt install build-essential
posted @ 2025-04-15 21:36  linzm14  阅读(97)  评论(0)    收藏  举报