如何运行“apt-get install”来安装所有依赖项?

mic*_*ael 66 apt

我在 ubuntu 服务器安装中运行这个:

sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386
Run Code Online (Sandbox Code Playgroud)

但我得到了这个:

Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version.
gnupg is already the newest version.
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:4.4.3) but it is not going to be installed
                   Depends: g++ (>= 4:4.4.3) but it is not going to be installed
 g++-multilib : Depends: cpp (>= 4:4.7.2-1ubuntu2) but it is not going to be installed
                Depends: gcc-multilib (>= 4:4.7.2-1ubuntu2) but it is not going to be installed
                Depends: g++ (>= 4:4.7.2-1ubuntu2) but it is not going to be installed
                Depends: g++-4.7-multilib (>= 4.7.2-1~) but it is not going to be installed
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

小智 74

sudo apt-get install -f
Run Code Online (Sandbox Code Playgroud)

这将安装您之前安装错过的任何依赖项。我刚刚更正了我的 teamviewer 和 VNC 安装。

  • 只是为了澄清,此命令将完全按照 `sudo apt-get install -f` 运行,而不是像我那样运行 `sudo apt-get install -f package_you_were_trying_to_install` :) (36认同)

小智 30

尝试 sudo apt-get build-dep build-essential

  • 你能解释一下这个命令会做什么吗? (3认同)
  • 这解释了 build-dep 的作用:https://superuser.com/a/151559/374907 (2认同)
  • 我收到此错误:E:您必须在您的 sources.list 中放入一些“deb-src”URI (2认同)

Rob*_*ila 6

你跑过: $ sudo aptitude update && sudo aptitude full-upgrade 以前吗?

  • 我没那么瘦。你确定带冒号的名字没问题吗?为什么不执行:`$ aptitude show package:i386` 用带有冒号的包名替换“package”? (2认同)