各种镜像源管理
pip镜像源
一般来说pip默认使用的源可能会比较慢,此时需要修改成国内的源
修改方法:
临时修改
在命令后面添加如下参数即可将安装源换成阿里云
1
-i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
只在当前命令中修改,以后想要使用时需要继续添加参数
特别说明: 在阿里云的服务器上使用这个指令时效果非常明显
永久修改
修改文件
~/.pip/pip.conf
内容, 如果没有该文件则新建一个1
2
3
4
5vim ~/.pip/pip.conf
# write the following contents and save
# the example is USTC
[global]
index-url = https://pypi.mirrors.ustc.edu.cn/simple/这个命令修改当前用户的默认
pip
命令镜像
镜像列表
1 | 清华:https://pypi.tuna.tsinghua.edu.cn/simple |
- 其中清华的比较常用
Ubuntu源
Linux一般默认使用自己系统的源,比如Ubuntu使用的就是自己的Ubuntu官网源
修改方法
- 修改文件
/etc/apt/source.list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18sudo /vim/apt/source.list
# write new image source
# the example of aliyun
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# update and upgrade
sudo apt-get update
sudo apt-get upgrade
镜像源列表
中科大源
1 | deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse |
163源
1 | deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse |
清华源
1 | deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse |
Centos源
修改方法
- 修改文件
/etc/yum.repos.d/CentOS-Base.repo
1
2
3
4
5
6
7
8
9# backup
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
# create new config file
# the example of aliyun, the config file could be downloaded from remote directly
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# update chche
sudo yum makechche
# update
sudo -y update
镜像源列表
网易源
- Centos6: http://mirrors.163.com/.help/CentOS6-Base-163.repo
- Centos7: http://mirrors.163.com/.help/CentOS7-Base-163.repo
阿里源
- Centos6: http://mirrors.aliyun.com/repo/Centos-6.repo
- Centos7: http://mirrors.aliyun.com/repo/Centos-7.repo
Mac brew源
- 参考链接:(Mac 下 brew 切换为国内源)[https://cloud.tencent.com/developer/article/1614039]