yarn、npm、yum、pip鏡像源


##########################################  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.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.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/

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章