flutter换源
使用环境变量:PUB_HOSTED_URL
FLUTTER_STORAGE_BASE_URL
,
upgrade出问题时可能会提示设置FLUTTER_GIT_URL
变量。
flutter中国
PUB_HOSTED_URL=https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
FLUTTER_GIT_URL=https://github.com/flutter/flutter.git
或者
FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter
PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub
FLUTTER_GIT_URL=https://mirrors.tuna.tsinghua.edu.cn/git/flutter-sdk.git
更新命令:
flutter upgrade
注:更换环境变量后 重启 或 注销用户后生效。
gradle
文件:build.gradle
highlighter- Dart
// 阿里源 maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
Python换源
Anacoda换源
两种方法:
使用命令
安装后,打开命令行工具,使用如下命令
highlighter- Dart
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ # 设置搜索时显示通道地址 conda config --set show_channel_urls yes
修改文件
在个人用户文件夹(一般都在C盘,用户文件夹下你用户名命名的一个文件夹),修改.condarc
文件,该成如下内容:
highlighter- Dart
channels: - defaults show_channel_urls: true default_channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 custom_channels: conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
运行conda clean -i
清除索引缓存,保证用的是镜像站提供的索引。
Linux换源
Kali换源
修改:/etc/apt/sources.list 文件,新增如下内容:
shell
#阿里云 deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib #清华大学 deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free #浙江大学 deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
更新命令:
highlighter- Dart
apt-get clean && apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
Ubuntu换源
修改 etc/apt/sources.list 内容,添加以下内容:
highlighter- Dart
# 阿里云源 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
更新命令:
highlighter- Dart
sudo apt-get update
npm换源
淘宝npm:http://registry.npm.taobao.org
淘宝新npm源:https://registry.npmmirror.com/
淘宝npm web站:https://npmmirror.com/
永久使用:
npm config set registry https://registry.npmmirror.com/ # 验证 npm config get registry
使用nrm
全局安装nrm
npm install -g nrm
然后就可以使用 nrm ls
查看可以使用的镜像源:
使用nrm use
就能切换源:
使用cnpm
npm install -g cnpm --registry=https://registry.npmmirror.com
临时一用
npm --registry https://registry.npmmirror.com install express