做什么会用到
- 01pip install 卡住或超时:临时换清华源 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple xxx
- 02npm 安装慢:换淘宝源 npm config set registry https://registry.npmmirror.com(注意:不是老的 npm.taobao.org,那地址废弃了)
- 03公司内网:可能强制走公司私有镜像,配置了 npm 才能装包
- 04镜像有时不同步:装某个最新发布的包失败时,临时切回官方源 --registry https://registry.npmjs.org 再装
想用它怎么问 AI
「我在国内,pip / npm 装包很慢/超时。请告诉我当前主流的国内镜像源、怎么配(永久和临时两种)、出问题时怎么切回官方。」
打个比方
像同一本书在多个仓库都有备货,本地仓库取货比从国外海运快得多。