每当我尝试使用 安装任何东西时apt-get
,都会收到错误消息:
apt-get install abinit
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.54-1ubuntu1) but 1.2.54-1ubuntu1.1 is to be installed
libpng12-0:i386 : Breaks: libpng12-0 (!= 1.2.54-1ubuntu1.1) but 1.2.54-1ubuntu1 is to be installed
libpng12-dev : Depends: libpng12-0 (= 1.2.54-1ubuntu1.1) but 1.2.54-1ubuntu1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
我该如何修复这个问题?如果我尝试建议的apt-get -f install
命令,它会抱怨:
Preparing to unpack .../libpng12-0_1.2.54-1ubuntu1.1_amd64.deb ...
Unpacking libpng12-0:amd64 (1.2.54-1ubuntu1.1) over (1.2.54-1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb (--unpack):
trying to overwrite shared '/usr/share/doc/libpng12-0/changelog.Debian.gz', which is different from other instances of package libpng12-0:amd64
Processing triggers for libc-bin (2.23-0ubuntu11.2) ...
Errors were encountered while processing:
/var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
聪明人会怎么做?
答案1
这句话似乎很重要:
trying to overwrite shared '/usr/share/doc/libpng12-0/changelog.Debian.gz'
一篇较早的文章 (打包过程中的 changelog.Debian.gz 文件是什么?)建议你可以安全地删除changelog.Debian.gz
(当然你也可以用 进行备份sudo cp /usr/share/doc/libpng12-0/changelog.Debian.gz ~/Desktop/changelog.Debian.gz
)
因此在这种情况下,我将首先删除更改日志,然后进行更新。
通常,当我遇到错误时apt
,apt-get
我也会运行它sudo apt-get clean
来进行一些基本的整理。
答案2
使用 重新配置包数据库sudo dpkg --configure -a
。然后重试。如果这仍然不起作用,请尝试删除 libpng。