The following packages have unmet dependencies: vim-gtk : Depends: vim-common (= 2:7.4.1689-3ubuntu

The following packages have unmet dependencies:
 vim-gtk : Depends: vim-common (= 2:7.4.1689-3ubuntu1.3) but 2:7.4.1689-3ubuntu1.2 is to be installed
           Depends: vim-runtime (= 2:7.4.1689-3ubuntu1.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

使用命令sudo apt-get install vim-gtk安装vim时报了这个错误。。。

然后上网查资料,首先参考这个方法https://www.zybang.com/question/94de2ee5201d94d3f24bfb9a0825c5d8.html修复受损软件包,然后再安装试试

结果第一步就有问题 

 嗯,放弃这个方法,又参考了这个方法http://blog.sina.com.cn/s/blog_8d56d7440102v6wo.html

上面说出现错误的原因可能是安装vim所依赖的vim-common和系统自带的vim-common版本冲突,解决办法就是先把vim-common卸载了然后再安装vim即可。

The following packages have unmet dependencies: vim-gtk : Depends: vim-common (= 2:7.4.1689-3ubuntu_第1张图片

 The following packages have unmet dependencies: vim-gtk : Depends: vim-common (= 2:7.4.1689-3ubuntu_第2张图片

嗯,照着这个方法我把报错相关的vim-common与vim-runtime都卸了,然后再安装试试

 

虽然还是报错了,但错误更少了,vim-runtime没问题了,嗯,继续查找资料。。。

 然后又试了试这个方法https://blog.csdn.net/T_NULL/article/details/80869396

这个较上面详细些https://blog.csdn.net/Davidietop/article/details/88934783

The following packages have unmet dependencies: vim-gtk : Depends: vim-common (= 2:7.4.1689-3ubuntu_第3张图片

但是还是不行。。。

The following packages have unmet dependencies: vim-gtk : Depends: vim-common (= 2:7.4.1689-3ubuntu_第4张图片 

上面那样也不行。。。

最后参考了这篇博客才解决https://blog.csdn.net/fcb_campnou/article/details/44851691#commentBox

不过我没执行sudo apt-get upgrade 这一步 

sudo apt-get purge vim-common

sudo apt-get update

sudo apt-get install vim-gtk

The following packages have unmet dependencies: vim-gtk : Depends: vim-common (= 2:7.4.1689-3ubuntu_第5张图片

 查了一下purge,

purge 命令是 remove 命令的另一个版本,它可以在删除软件本身的同时,删除软件包的残余设置。类似于 Windows 环境下删除软件后的“软件残余”清理。

在终端中执行:sudo apt-get purge 软件名

将删除相关软件,同时删除该软件的配置文件。

看来可能是之前用remove命令删除没删干净啊。。。

你可能感兴趣的:(linux)