由于软件包损坏,无法在 ubuntu 13.10 中安装 g++

sha*_*999 2 package-management apt dependencies

当我尝试在我的机器上安装 g++ 时,我收到以下消息。

support:/$ 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 packages.
Run Code Online (Sandbox Code Playgroud)

我正在使用 Ubuntu 13.10(Saucy)。我已经坚持这个问题 2 天了。我知道这是一个重复的问题,但我仍然发布它,因为我无法从其他类似的帖子中找到解决方案。

我已经尝试了Package system 中给出的所有解决方案如何解决?. 但它无法解决问题。

正如在https://askubuntu.com/questions/385008/cant-install-g-on-13-10-dependency-problem的评论中所问的,我把结果放在apt-cache policy g++ g++-4.8下面

g++:
  Installed: (none)
  Candidate: 4:4.8.1-2ubuntu3
  Version table:
     4:4.8.1-2ubuntu3 0
        500 http://de.archive.ubuntu.com/ubuntu/ saucy/main i386 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 i386 Packages
     4.8.1-10ubuntu8 0
        500 http://de.archive.ubuntu.com/ubuntu/ saucy/main i386 Packages
Run Code Online (Sandbox Code Playgroud)

PS:我不是在寻找任何特定版本的 g++。实际工作场景是我想安装依赖于“node-gyp”的 npm 包“libxmljs”。要正确安装“node-gyp”,系统应该具有“make”、“g++”和“python”。我的系统中有 make 和 python。以下是我运行时得到的g++ --version

The program 'g++' can be found in the following packages:
 * g++
 * pentium-builder
Try: sudo apt-get install <selected package>
Run Code Online (Sandbox Code Playgroud)

请帮我解决这个问题。

sha*_*999 5

有关如何解决损坏的包问题的详细解决方案可以在此处找到如何在添加 PPA 后解决未满足的依赖项?

如果您无法使用上述链接中的解决方案解决损坏的软件包问题,那么您可以使用“aptitude”而不是“apt”。请使用以下命令解决问题。

sudo apt-get install aptitude

sudo aptitude install build-essential
Run Code Online (Sandbox Code Playgroud)