ubuntu:vim的安装及部分问题解决方法

VIM的安装及部分问题解决方法

1.刚安装好Ubuntu后需要装vim编辑器时,在终端输入vim test.c时会出现下面情况:

nigel@yq-ubuntu:~/worksp$ vim test.c

The program ‘vim’ can be found in the following packages:

  • vim

  • vim-gnome

  • vim-tiny

  • vim-athena

  • vim-gtk

  • vim-nox

Try: sudo apt-get install

nigel@yq-ubuntu:~/worksp$

这说明系统还未安装vim编辑器。

2.但是当我输入sudo apt-get install vim-gtk时(我们用的vim就是这个安装包),

再次出现了下面这样的问题:

nigel@yq-ubuntu:~/worksp$ sudo apt-get install vim-gtk

Reading package lists… Done

Building dependency tree

Reading state information… Done

Package vim-gtk is not available, but is referred to by another package.

This may mean that the package is missing, has been obsoleted, or

is only available from another source

E: Package ‘vim-gtk’ has no installation candidate

这种情况如果你没有出现说明你的软件源设置是可以的,我的刚装好没有选择软件源就会出现这个提示,找不到这个包。这时,我们应该在software center中找到software sources(软件源设置),点击Ubuntu software->找到download from点击进去选择other…->select best server ,然后他会自动寻找适合你IP的最佳软件源,静静等待。找到之后,chooes server退出即可。

3.我们再次回到终端,执行sudo apt-get update更新一下

4.然后我们再次执行sudo apt-get install vim-gtk,

这次发现还是没有成功,而是出现了下面这种情况:

nigel@yq-ubuntu:~/worksp$ sudo apt-get install vim-gtk

Reading package lists… Done

Building dependency tree

Reading state information… Done

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:

vim-gtk : Depends: vim-common (= 2:7.3.429-2ubuntu2) but 2:7.3.429-2ubuntu2.1 is to be installed

E: Unable to correct problems, you have held broken packages.

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

5.执行这句话sudo apt-get remove vim-common 卸载vim-common

6.再次执行sudo apt-get install vim-gtk,这次会发现成功了!!!呵呵。

——(文档由nigel-yq 编写)

猜你喜欢

转载自blog.csdn.net/weixin_41884153/article/details/81504663