開發(fā)過程中,我們經(jīng)常會(huì)用到各種各樣的包管理工具,幾乎每種包管理工具缺省設(shè)置都是從國(guó)外服務(wù)器下載相應(yīng)的軟件安裝包,或者下載很慢,或者干脆無法下載。以下列出我常用的所有國(guó)內(nèi)鏡像,方便有類似需求的同學(xué)參考 (不定期更新,感覺有用的同學(xué)請(qǐng)注意收藏)。
我平常用的 shell
是fish
,所以下面的語(yǔ)法全都是fish
相關(guān)的set -x
,如果是用缺省的bash
,可以替換成export
命令。
操作系統(tǒng)相關(guān)
brew國(guó)內(nèi)鏡像
cd /usr/local/Homebrew
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
# brew國(guó)內(nèi)鏡像
set -x HOMEBREW_BOTTLE_DOMAIN https://mirrors.ustc.edu.cn/homebrew-bottles
JAVAscript相關(guān)
npm國(guó)內(nèi)鏡像
npm config set registry https://registry.npm.taobao.org/
yarn國(guó)內(nèi)鏡像
yarn config set registry https://registry.npm.taobao.org/
pnpm國(guó)內(nèi)鏡像
pnpm config set registry https://registry.npm.taobao.org/
electron國(guó)內(nèi)鏡像
set -x ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/
node-sass國(guó)內(nèi)鏡像
set -x SASS_BINARY_SITE https://npm.taobao.org/mirrors/node-sass/
fsevents國(guó)內(nèi)鏡像
set -x FSE_BINARY_HOST_MIRROR https://npm.taobao.org/mirrors/fsevents/
更多
更多設(shè)置,或者懶得一個(gè)一個(gè)設(shè)置的同學(xué)也可以參考這里:
https://gist.github.com/hetyk...
把這些代碼下載到一個(gè)shell腳本里,一鍵添加完成。
Python相關(guān)
pip國(guó)內(nèi)鏡像
$ cat ~/.pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
conda國(guó)內(nèi)鏡像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
其它語(yǔ)言
flutter國(guó)內(nèi)鏡像
set -x PUB_HOSTED_URL https://pub.flutter-io.cn
set -x FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn
補(bǔ)充
github國(guó)內(nèi)鏡像
如果是在 git clone
時(shí)遇到了問題,可以先在碼云建立一個(gè)庫(kù),來源取自github,然后同步碼云這個(gè)庫(kù)即可。
作者:張京
來源:https://segmentfault.com/a/1190000023288827