无法安装 Vim(依赖:vim-common(= 2:7.4.1689-3ubuntu1.2)但需要安装 2:7.4.1689-3ubuntu1)

无法安装 Vim(依赖:vim-common(= 2:7.4.1689-3ubuntu1.2)但需要安装 2:7.4.1689-3ubuntu1)

我正在尝试安装 Vim。我收到以下错误

$ sudo apt-get install vim

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:
 libpng12-0 : Breaks: libpng12-0:i386 (!= 1.2.50-2+deb8u3) but 1.2.54-1ubuntu1 is to be installed
 libpng12-0:i386 : Breaks: libpng12-0 (!= 1.2.54-1ubuntu1) but 1.2.50-2+deb8u3 is to be installed
 vim : Depends: vim-common (= 2:7.4.1689-3ubuntu1.2) but 2:7.4.1689-3ubuntu1 is to be installed
       Depends: vim-runtime (= 2:7.4.1689-3ubuntu1.2) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

然后我尝试运行没有软件包的 apt-get -f install。然后我收到此错误

  The following additional packages will be installed:
libpng12-0
The following packages will be upgraded:
  libpng12-0
1 upgraded, 0 newly installed, 0 to remove and 594 not upgraded.
3 not fully installed or removed.
Need to get 116 kB of archives.
After this operation, 11.3 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 libpng12-0 amd64 1.2.54-1ubuntu1 [116 kB]
Fetched 116 kB in 1s (69.8 kB/s)     
(Reading database ... 240235 files and directories currently installed.)
Preparing to unpack .../libpng12-0_1.2.54-1ubuntu1_amd64.deb ...
Unpacking libpng12-0:amd64 (1.2.54-1ubuntu1) over (1.2.50-2+deb8u3) ...
dpkg: error processing archive /var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1_amd64.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libpng12-0/ANNOUNCE', which is different from other instances of package libpng12-0:amd64
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Errors were encountered while processing:
 /var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

如果有人能指出这个错误的原因并给出解决方案,那将非常有帮助。我使用的是 Ubuntu 16.04

$ cat /etc/apt/sources.list

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://archive.ubuntu.com/ubuntu/ xenial universe
deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

答案1

可能的解决方法是重命名该目录,并强制安装如下,

sudo mv /usr/share/doc/libpng12-0 /usr/share/doc/libpng12-0.backup
sudo apt-get -f install

或者这也可能解决你的问题,

sudo apt-get install libpng12-0 libpng12-0:i386

来源

相关内容