zoukankan      html  css  js  c++  java
  • Ubuntu无法安装vim:Package vim is not available, but is referred to by another package.

    刚安装的Ubuntu18.10输入 sudo apt-get install vim 安装vim时出现如下问题:

    helloworld@helloworld-Inspiron-5537:~$ sudo apt-get install vim
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package vim 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' has no installation candidate

    这个问题的原因是ubuntu的/etc/apt/source.list中的源比较旧了,需要更新一下,更新方法:

    $ sudo apt-get update

    更新完毕之后,再使用 sudo apt-get install vim 安装应该就没有问题了。

    如果还有问题,就说明你的源有问题->

    1.保险做法先备份源文件:  cp -i /etc/apt/sources.list /etc/apt/sources.list_backup

    2.打开sources.list:   sudo gedit /etc/apt/sources.list   

    3.在源文件中复制粘贴如下阿里云的源到文件的最前边,然后保存退出。

    deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
    deb http://archive.canonical.com/ubuntu xenial partner
    deb-src http://archive.canonical.com/ubuntu xenial partner
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

    4.更新:sudo apt-get update

    5.更新后,再安装vim,sudo apt-get install vim

    这次应该就没有问题了。

    如何修改源列表

    http://wiki.ubuntu.org.cn/%E6%BA%90%E5%88%97%E8%A1%A8#Vivid.2815.04.29.E7.89.88.E6.9C.ACsudo%20gedit%20/etc/apt/sources.list

    服務器列表

    http://wiki.ubuntu.org.cn/%E6%A8%A1%E6%9D%BF:18.04source

  • 相关阅读:
    hdu2191(多重背包)
    hdu3664(递推dp)
    hdu2955(变形01背包)
    hdu1712(分组背包)
    hdu1114(完全背包)
    hdu4004(二分)
    hdu2870(dp求最大子矩阵)
    POJ 1979 Red and Black(水题,递归)
    POJ 1922 Ride to School(贪心+模拟)
    POJ 1182 食物链(种类并查集)
  • 原文地址:https://www.cnblogs.com/www-helloworld-com/p/10202939.html
Copyright © 2011-2022 走看看