背景
开发过程中,经常遇到软件源在国外,导致下载很慢的问题,这里汇总各种国内源以及设置方法
brew源修改
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
参考:https://www.jianshu.com/p/fdf7e316f096
pip源修改
# 腾讯源
pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple
# 清华源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 或:
# 阿里源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
# 豆瓣源
pip config set global.index-url http://pypi.douban.com/simple/
下载过程中,如果遇到"--trusted-host"之类的报错,则只需要在安装的时候,指定trusted-host即可,如下
pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple
sudo pip3 install -r requirements.txt --trusted-host mirrors.cloud.tencent.com