########################################## yarn #####################################
1.查看当前镜像源
yarn config get registry
2.临时修改yarn源
yarn save package_name --registry https://registry.npm.taobao.org/
3.修改yarn源为taobao源
yarn config set registry https://registry.npm.taobao.org/
4.修改yarn源为官方源
yarn config set registry https://registry.yarnpkg
########################################## npm #####################################
1.查看源:
npm config get registry
2.更改为npm淘宝源:
npm config set registry https://registry.npm.taobao.org
3.更改为npm官方源:
npm config set registry https://registry.npmjs.org
4.临时修改npm源
npm install module_name --registry https://registry.npm.taobao.org
########################################## yum #####################################
1.备份原有yum源:
mv /etc/yum.repos.d /etc/yum.repos.d.bak
2.创建yum源目录
mkdir /etc/yum.repos.d
3.下载阿里云yum源配置
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
4.重建缓存
yum clean all
yum makecache
########################################## pip #####################################
1.临时
pip install package_name -i https://pypi.tuna.tsinghua.edu.cn/simple
2.永久修改:需要修改配置文件
Windows:
1.进入%APPDATA%目录,例如我的是C:\Users\Raytine\AppData\Roaming
2.新建pip文件夹,如果有则跳过
3.进入pip文件夹,新建pip.ini文件,设置pip源,如下所示为清华大学的pip源:
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
timeout = 6000
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
disable-pip-version-check = true
Linux:
1.cd ~ # 进入家目录
2.mkdir .pip # 新建.pip隐藏文件夹
3.touch pip.conf # 进入.pip文件夹,新建pip.conf文件
4.vim pip.conf # 用vim编辑pip.conf文件,内容与Windows下pip.ini文件的内容一样
5.保存退出
其他国内pip源:
豆瓣 ··············· http://pypi.douban.com/
华中理工大学 ········ http://pypi.hustunique.com/
山东理工大学 ········ http://pypi.sdutlinux.org/
中国科学技术大学 ···· http://pypi.mirrors.ustc.edu/
阿里云 ············· http://mirrors.aliyun.com/pypi/simple/
清华大学 ··········· https://pypi.tuna.tsinghua.edu.cn/simple/