3【技术分享】国内开发加速方法合集
brandonxiang opened this issue · 0 comments
brandonxiang commented
由于国内GFW的限制,作为开发者,不得不养成加速安装的良好习惯。
Ubuntu apt-get
cd /etc/apt
sudo cp sources.list sources.list.backup
添加资源,我信阿里云。
sudo vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# 源码
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
##测试版源
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# Canonical 合作伙伴和附加
deb http://archive.canonical.com/ubuntu/ xenial partner
deb http://extras.ubuntu.com/ubuntu/ xenial main
额外参考安装Ubuntu 16.04后要做的事 。
brew Mac
export HOMEBREW_BOTTLE_DOMAIN=http://7xkcej.dl1.z0.glb.clouddn.com
Github Clone
Ubuntu 修改hosts映射(/etc/hosts)
185.31.16.184 github.global.ssl.fastly.net
pip python
python 加速方法
清华: https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣: http://pypi.douban.com/simple/
阿里: http://mirrors.aliyun.com/pypi/simple/
方法一:临时换源
在安装同时,你可以多输入两个参数。
sudo pip install scrapy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
方法二:永久换源
配置文件~/.pip/pip.conf
:
[global]
index-url = http://pypi.douban.com/simple/
[install]
trusted-host = http://pypi.douban.com/simple/
最终解决方案
使用我写的换源库--brandonxiang/psm
参考Python 笔记九:打造pypi换源加速神器
npm nodejs
最终解决方案
使用换源库Pana/nrm
参考 phantomjs 下载镜像 PHANTOMJS_CDNURL,同理也可以为很多node.js构建工具的库进行提速。在你的`npm install
registry=https://registry.npm.taobao.org
sass_binary_site=https://npm.taobao.org/mirrors/node-sass
phantomjs_cdnurl=http://npm.taobao.org/mirrors/phantomjs
ELECTRON_MIRROR=http://npm.taobao.org/mirrors/electron