ubuntu 更改系统源和 pip 源

0x00

官方源太慢?更换源吧。

0x01

  • 更换系统源

我的系统是 ubuntu 16.04

1
2
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vim /etc/apt/sources.list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

## Not recommended
# deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

或者使用这个链接配置

  • 更改 pip 源
1
2
mkdir ~/.pip
vim ~/.pip/pip.conf
1
2
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

0x02

参考资料:

https://blog.csdn.net/qq_30163461/article/details/80401353

Author: ronething
Link: https://blog.ronething.cn/20190528-pip-apt.html
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.