ubuntu 18 python3.6国内ソースとpip 3ソースの交換

3801 ワード

1.国内ソースの交換


Ubuntu 18バージョンとcodenameの表示(codename対応に注意)
1 lsb_release -a
1 No LSB modules are available.
2 Distributor ID:    Ubuntu
3 Description:    Ubuntu 18.10
4 Release:    18.10
5 Codename:    cosmic

バックアップ
cp /etc/apt/sources.list /etc/apt/sources.list.bak
 1 vim /etc/apt/sources.list
 2 
 5 deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic main restricted universe multiverse
 6 deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic main restricted universe multiverse
 7 deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic-updates main restricted universe multiverse
 8 deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic-updates main restricted universe multiverse
 9 deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic-backports main restricted universe multiverse
10 deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic-backports main restricted universe multiverse
11 deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic-security main restricted universe multiverse
12 deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic-security main restricted universe multiverse
13 deb https://mirrors.ustc.edu.cn/ubuntu/ cosmic-proposed main restricted universe multiverse
14 deb-src https://mirrors.ustc.edu.cn/ubuntu/ cosmic-proposed main restricted universe multiverse

更新
1 apt update
2 apt upgrade

結果はすぐに

2.豆弁pipを交換する


フォルダの作成
mkdir ~/.pip
cd ~/.pip/

プロファイルの編集
1 vim pip.conf
2 [global] 
3 index-url = http://pypi.douban.com/simple 
4 [install] 
5 trusted-host=pypi.douban.com

インストールpip 3
1 pip install python3-pip

django速度25 MB/sのインストール
pip3 install django

個々のpipソースを毎回使用することもできます
1 pip install pygame -i http://pypi.douban.com/simple
2 pip install pygame -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

 
転載先:https://www.cnblogs.com/Rightsec/p/11006081.html