当我尝试下载某些东西时,我会使用
sudo apt-get install/upgrade (package)
但是,这会给我错误消息:
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
google-chrome-stable : Depends: libpango1.0-0 (>= 1.14.0) but it is not installed
Depends: libappindicator1 but it is not installed
E: Unmet dependencies. Try using -f.
因此,我尝试使用-f
。
sudo apt-get -f install (package)
并且仍然有错误信息。
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
0ad : Depends: 0ad-data (>= 0.0.20) but it is not going to be nstalled
Depends: 0ad-data (<= 0.0.20-1) but it is not going to be installed
Depends: 0ad-data-common (>= 0.0.20) but it is not going to be installed
Depends: 0ad-data-common (<= 0.0.20-1) but it is not going to be installed
Depends: libenet7 but it is not going to be installed
Depends: libgloox13v5 but it is not going to be installed
Depends: libnvtt2 but it is not going to be installed
Depends: libopenal1 (>= 1.14) but it is not going to be installed
Depends: libsdl2-2.0-0 (>= 2.0.4) but it is not going to be installed
Depends: libwxbase3.0-0v5 (>= 3.0.2+dfsg) but it is not going to be installed
Depends: libwxgtk3.0-0v5 (>= 3.0.2+dfsg) but it is not going to be installed
google-chrome-stable : Depends: libpango1.0-0 (>= 1.14.0) but it is not going to be installed
Depends: libappindicator1 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
我怎样才能解决这个问题?
答案1
好吧,这是依赖混乱的典型案例。
首先,去你的软件源应用程序并确保main
、universe
和multiverse
(可选)都已启用。
然后,返回到您的终端并运行以下命令来刷新您的包缓存:
sudo apt update
使用这些命令正如下面所示升级你的系统并清理依赖混乱:
sudo apt -f install
sudo apt full-upgrade
sudo apt -f install
如果这仍然不起作用,我们将不得不求助于其他工具,即aptitude
。由于您的apt
已损坏,我们将不得不手动安装它。访问这一页并选择最合适的版本aptitude
并下载。这可能是xenial amd64
,但请检查您的系统。
aptitude
然后,运行以下命令在您的系统上安装:
sudo dpkg -i <whatever you downloaded>.deb
然后运行:
sudo aptitude -f
Aptitude 的依赖解析/修复系统是轻微地比 Apt 更复杂,因此更有可能解决您可能遇到的任何问题。
答案2
我刚刚找到了解决这个问题的方法。我必须打开终端并输入
sudo dpkg --configure -a
dpkg 中曾出现过中断,这解决了问题。
答案3
sudo apt-get install/upgrade (package)
不是一个合法的命令。您可以通过输入以下内容来安装新软件包:
sudo apt-get install vlc #Where vlc is the name of the pkg you want to install
您可以通过输入以下命令进行升级:
sudo apt-get update # updates the repositoty packages
sudo apt-get upgrade vlc # upgrades the VLC package to the latest version.
在您的升级示例中,您发布了缺少依赖项的列表。解决此问题的最简单方法是卸载软件包(在您的示例中为 google-chrome-stable)并重新安装。显然,它之前安装不正确。
您还可以通过键入以下内容逐步解决依赖性问题:
sudo apt-get install libpango1*
sudo apt-get install libappindicator1*
etc.
我建议阅读 apt-get 手册页:
man apt
man apt-get
对于大多数常用软件包,最好使用“Ubuntu 软件”功能来安装和升级软件包(例如 chrome)。这将确保所有依赖项与所需软件包一起安装。