美文网首页
Ubuntu apt-get 和 pip 更换源

Ubuntu apt-get 和 pip 更换源

作者: TechManZhang | 来源:发表于2018-10-07 17:20 被阅读0次

    Ubuntu系统自带的源都是国外的网址,国内用户在使用的时候网速比较慢。一个软件的下载是十分痛苦的,这里讲解一下如何将国外源更换为国内源,让你的网速Biu.Biu.Biu。

    更换apt-get数据源

    1.备份原先的源

    sudo cp /etc/apt/sources.list  /etc/apt/sources.list.back_20181007

    将以前的源备份一下,以防以后可以用的。

    2.更换源

    sudo gedit /etc/apt/sources.list

    使用gedit打开文档,将下边的阿里源复制进去,然后点击保存关闭。

    阿里源

    deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

    deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 

    deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 

    deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 

    deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 

    deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse 

    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse 

    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse 

    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse 

    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe

    3.更新源与软件

    更新源

    sudo apt-get update

    更新软件

    sudo apt-get upgrade

    4.其他常用源

    西电源(只有校内网网线使用,但是不限制流量,还是十分靠谱的)

    deb http://linux.xidian.edu.cn/mirrors/ubuntu/ xenial main restricted universe multiverse#deb-srchttp://linux.xidian.edu.cn/mirrors/ubuntu/ xenial main restricted universe multiversedeb http://linux.xidian.edu.cn/mirrors/ubuntu/ xenial-security main restricted universe multiverse#deb-srchttp://linux.xidian.edu.cn/mirrors/ubuntu/ xenial-security main restricted universe multiversedeb http://linux.xidian.edu.cn/mirrors/ubuntu/ xenial-updates main restricted universe multiverse#deb-srchttp://linux.xidian.edu.cn/mirrors/ubuntu/ xenial-updates main restricted universe multiverse#debhttp://linux.xidian.edu.cn/mirrors/ubuntu/ xenial-backports main restricted universe multiverse#deb-srchttp://linux.xidian.edu.cn/mirrors/ubuntu/ xenial-backports main restricted universe multiverse#debhttp://linux.xidian.edu.cn/mirrors/ubuntu/ xenial-proposed main restricted universe multiverse#deb-srchttp://linux.xidian.edu.cn/mirrors/ubuntu/ xenial-proposed main restricted universe multiverse

    清华源

    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

    网易源

    deb http://mirrors.163.com/ubuntu/ wily main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiversedeb http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiversedeb-srchttp://mirrors.163.com/ubuntu/ wily main restricted universe multiversedeb-srchttp://mirrors.163.com/ubuntu/ wily-security main restricted universe multiversedeb-srchttp://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiversedeb-srchttp://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiversedeb-srch    ttp://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse

      参考网址:https://blog.csdn.net/qq_35451572/article/details/79516563

    更换pip数据源

    1.根目录创建.pip文件

    mkdir ~/.pip

    2.创建文件pip.conf

    vim .pip/pip.conf

    3.点击“i”键,进入编辑模式,复制以下信息:

    [global]

    index-url = https://pypi.tuna.tsinghua.edu.cn/simple

    trusted-host = pypi.tuna.tsinghua.edu.cn

    4.点击:“ESC”切换到命令行模式,输入“:wq”保存离开。

    5.其他常用源

    清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

    阿里云 http://mirrors.aliyun.com/pypi/simple/

    中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

    豆瓣(douban) http://pypi.douban.com/simple/

    中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

    相关文章

      网友评论

          本文标题:Ubuntu apt-get 和 pip 更换源

          本文链接:https://www.haomeiwen.com/subject/qehhaftx.html