如何解决这个问题:
sahil@sahil-XPS-L501X ~ $ sudo apt-get 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: gcc (>= 4:4.8.1-2ubuntu3) but it is not going to be installed
Depends: g++-4.8 (>= 4.8.1-4~) but it is not going to be installed
Depends: gcc-4.8 (>= 4.8.1-4~) but it is not going to be installed
E: Unable to correct problems, you have held broken package
sahil@sahil-XPS-L501X ~ $ sudo apt-cache policy g++ gcc g++-4.8 gcc-4.8
g++:
Installed: (none)
Candidate: 4:4.8.1-2ubuntu3
Version table:
4:4.8.1-2ubuntu3 0
500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
gcc:
Installed: (none)
Candidate: 4:4.8.1-2ubuntu3
Version table:
4:4.8.1-2ubuntu3 0
500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
g++-4.8:
Installed: (none)
Candidate: 4.8.2-1ubuntu1
Version table:
4.8.2-1ubuntu1 0
500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ saucy/main amd64 Packages
4.8.1-10ubuntu9 0
500 http://archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
4.8.1-10ubuntu8 0
500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
gcc-4.8:
Installed: (none)
Candidate: 4.8.2-1ubuntu1
Version table:
4.8.2-1ubuntu1 0
500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ saucy/main amd64 Packages
4.8.1-10ubuntu9 0
500 http://archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
4.8.1-10ubuntu8 0
500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)
小智 5
假设 debian 软件包出现问题,请尝试以下操作:
dpkg -l|grep -v ^ii
Run Code Online (Sandbox Code Playgroud)
这列出了所有未正确安装的软件包。
dpkg -P package
Run Code Online (Sandbox Code Playgroud)
卸载(清除)受影响的软件包。
dpkg -P --force-all package
Run Code Online (Sandbox Code Playgroud)
如果它仍然具有抵抗力,请尝试用力。
dpkg --configure -a
Run Code Online (Sandbox Code Playgroud)
尝试刷新所有尚未配置的包。
apt-get update
Run Code Online (Sandbox Code Playgroud)
在安装新软件包之前始终更新。
apt-get install package
Run Code Online (Sandbox Code Playgroud)
现在应该可以了。