Linux如何更换pip的源和apt-get的源

(1)使用pip install安装Python的相关库时,国外的源速度较慢,修改为国内的源(豆瓣源)

编辑配置文件, 如果没有, 新建一份:

vi ~/.pip/pip.conf  

添加内容如下:

[global]  
index-url = http://pypi.douban.com/simple  
trusted-host = pypi.douban.com  

(2)修改apt-get源(参考:apt-get切换国内源)  

输入下面命令:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo vi /etc/apt/sources.list
之后将文件中源地址修改国内源的地址。( 源列表 - Ubuntu中文
Trusty(14.04)版本地址列表:
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 multiverse
之后可以输入下面命令测试一下更新下载速度
sudo apt-get update

猜你喜欢

转载自blog.csdn.net/qq_28093585/article/details/79828218
今日推荐