1.更换国内源

查看Ubuntu18版本和codename(一定要注意codename对应)

 lsb_release -a
 No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic

先备份

cp /etc/apt/sources.list /etc/apt/sources.list.bak
 vim /etc/apt/sources.list

 deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic-proposed main restricted universe multiverse

更新

 apt update
apt upgrade

结果显示很快的

2.更换豆瓣pip

创建文件夹

mkdir ~/.pip
cd ~/.pip/

编辑配置文件

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

安装pip3

 pip install python3-pip

安装django速度25MB/s

pip3 install django

也可以每次使用单独的pip源

 pip install pygame -i http://pypi.douban.com/simple
pip install pygame -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
05-11 19:38