更換apt-get源
首先備份系統(tǒng)自帶的源
mv /etc/apt/sources.list /etc/apt/sources.list.bak
打開sources.list文件
vim?/etc/apt/sources.list
在里面加入阿里云的源
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
更新源
apt-get update
這一步是更新上面列出的源地址,從而能獲取最新的軟件包
apt-get upgrade
這一步是升級(jí)已安裝的所有軟件包怀跛,所以這一步需要在apt-get update之后執(zhí)行。
更換pip源
創(chuàng)建pip文件夾并打開
mkdir ~/.pip
vim ~/.pip/pip.conf
按 i 輸入以下信息
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
然后按Esc掏呼,再按:wq退出即可
除了阿里云的源井佑,還可以替換為下面的源:
清華:https://pypi.tuna.tsinghua.edu.cn/simple
中國科技大學(xué) https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣:http://pypi.douban.com/simple/