整理一些换源的需求:
pip
mac和linux
- 创建文件
~/.pip/pip.conf
,如果已经存在就不用创建:
mkdir ~/.pip
vim ~/.pip/pip.conf
- 文件内容为:
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
windows
- 创建文件
%APPDATA%\pip\pip.ini
- 文件内容为:
[global]
timeout = 6000
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com
其它安装源
上面都是以阿里云安装源为例,除此以外还有一些其它的安装源,替换index-url
和trusted-host
即可:
- 阿里云
http://mirrors.aliyun.com/pypi/simple/
- 中国科技大学
https://pypi.mirrors.ustc.edu.cn/simple/
- 豆瓣(douban)
http://pypi.douban.com/simple/
- 清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/
- 中国科学技术大学
http://pypi.mirrors.ustc.edu.cn/simple/
- V2EX
http://pypi.v2ex.com/simple
npm
npm换源比较简单,一行代码即可:
npm config set registry https://registry.npm.taobao.org
切换完成后可以进行测试:
npm config get registry
yarn
安装tyarn
即可,然后用tyarn
代替yarn
使用,会自动使用淘宝源:
sudo npm install -g yarn tyarn
git
git设置代理
- git全局代理
git config --global http.proxy socks5://127.0.0.1:1086
- github代理
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
git取消代理
- git全局取消代理
git config --global --unset http.proxy
- github取消代理
git config --global --unset http.https://github.com.proxy
cocoapods
pod setup
命令过慢时,参照上面的命令为github设置代理即可
gem
- 查看gem源
gem source -l
- 删除源
gem source -r <源地址>
- 添加源
gem sources --add <源地址>
4.目前能用的源 之前淘宝的源已经无法使用,目前能用的源:
https://gems.ruby-china.com
本文由 李海平 创作,采用 知识共享署名4.0
国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Oct 11,2019