背景
開發過程中,經常遇到軟件源在國外,導致下載很慢的問題,這裏彙總各種國內源以及設置方法
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