常用源的更换步骤
更换 pip 源
linux 下,修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url,内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
windows 下,直接在 user 目录中创建一个 pip 目录,如:C:\Users\xx\pip,新建文件 pip.ini,内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
更改 pipenv 源
- 切换目录到项目文件根目录
- 查看 Pipfile 的内容: cat Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
flask = "*"
requests = "*"
wtforms = "*"
flask-sqlalchemy = "*"
cymysql = "*"
flask-login = "*"
[dev-packages]
[requires]
python_version = "3.7"
- 我们要修改的就是 [[source]] 下的 url
- 打开 Pipfile 编辑:
vim Pifile
- 把第二行的 url 换成清华源(其实还可以把 name 也改动一下,我偷懒就不改了):
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
- 保存退出:
:wq
- 查看修改后的 Pipfile :
cat Pipfile
[[source]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
verify_ssl = true
name = "pypi"
[packages]
flask = "*"
requests = "*"
wtforms = "*"
flask-sqlalchemy = "*"
cymysql = "*"
flask-login = "*"
[dev-packages]
[requires]
python_version = "3.7"
更换 homebrew 源
更换 go 源
更换 rust 相关源
更换 ipfs 网关
- 进入 Public IPFS Gateways,查找有效的网关
- export IPFS_GATEWAY={}
更换 centos 源和 epel 源
$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
$ wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
更换 ubuntu apt 源
# 18.04 only
$ sed -i '' -e '1i \
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 \
\
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse \
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse \
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse \
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse \
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse \
' /etc/apt/sources.list