一站配齐所有国内镜像,第三方库安装提升 10 倍

小詹学Python

共 2500字,需浏览 5分钟

 ·

2020-08-04 18:22

点击上方“小詹学Python”,选择设为“设为星标

优质文章,第一时间送达!


开发过程中,我们经常会用到各种各样的包管理工具,几乎每种包管理工具缺省设置都是从国外服务器下载相应的软件安装包,或者下载很慢,或者干脆无法下载。以下列出我常用的所有国内镜像,方便有类似需求的同学参考 (不定期更新,感觉有用的同学请注意收藏)

我平常用的 shellfish ,所以下面的语法全都是 fish 相关的 set \-x ,如果是用缺省的 bash ,可以替换成 export 命令。

操作系统相关

brew国内镜像

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国内镜像
set -x HOMEBREW\_BOTTLE\_DOMAIN https://mirrors.ustc.edu.cn/homebrew-bottles

Javascript相关

npm国内镜像

npm config set registry https://registry.npm.taobao.org/

yarn国内镜像

yarn config set registry https://registry.npm.taobao.org/

pnpm国内镜像

pnpm config set registry https://registry.npm.taobao.org/

electron国内镜像

set -x ELECTRON\_MIRROR http://npm.taobao.org/mirrors/electron/

node-sass国内镜像

set -x SASS\_BINARY\_SITE https://npm.taobao.org/mirrors/node-sass/

fsevents国内镜像

set -x FSE\_BINARY\_HOST\_MIRROR https://npm.taobao.org/mirrors/fsevents/

更多

更多设置,或者懒得一个一个设置的同学也可以参考这里:

https://gist.github.com/hetyk...

把这些代码下载到一个shell脚本里,一键添加完成。

Python相关

pip国内镜像

\$ cat \~/.pip/pip.conf
\[global\]
index\-url=https://pypi.tuna.tsinghua.edu.cn/simple

conda国内镜像

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

其它语言

flutter国内镜像

set -x PUB\_HOSTED\_URL https://pub.flutter-io.cn
set -x FLUTTER\_STORAGE\_BASE\_URL https://storage.flutter-io.cn

补充

github国内镜像

如果是在 git clone 时遇到了问题,可以先在码云建立一个库,来源取自github,然后同步码云这个库即可。


作者:张京 

来源:https://segmentfault.com/a/1190000023288827


——  e n d ————


由于微信平台算法改版,公号内容将不再以时间排序展示,如果大家想第一时间看到我们的推送,强烈建议星标我们和给我们多点点【在看】。星标具体步骤为:


(1)点击页面最上方“小詹学Python”,进入公众号主页。


(2)点击右上角的小点点,在弹出页面点击“设为星标”,就可以啦。


感谢支持,比心。


浏览 16
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报