各类应用的中国镜像源汇总¶
cheatsheet¶
pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple
# 有时候国内的源并不是最新的
pip config unset global.index-url
github clone¶
现在很多镜像clone站不是那么稳定(尤其是对于很小的项目来说)
https://github.com/hedzr/mirror-listchina-mainland-mirrors
修改 hosts 的方法
https://github.com/521xueweihan/GitHub520
自己搭建一个 github 代理
https://github.com/hunshcn/gh-proxy
docker run -d --name="gh-proxy-py" \
-p 0.0.0.0:8111:80 \
--restart=always \
hunsh/gh-proxy-py:latest
然后这么clone!!
https://github.gennia.io/https://github.com/GenniaApp/GenniaServer2
如果遇到CA 错误: CAfile: none CRLfile: none
git config –global http.sslverify false
npm/yarn/pnpm¶
// 设置
npm config set registry https://registry.npmmirror.com/
yarn config set registry https://registry.npmmirror.com/
pnpm config set registry https://registry.npmmirror.com/
// 查看
npm config get registry
yarn config get registry
pnpm config get registry
node-sass 淘宝镜像设置
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
pnpm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
conda && pip¶
功能 | 命令 |
---|---|
conda | |
查看源、是否添加成功 | conda config –show-sources |
清除索引缓存,保证用的是新源 | conda clean -i |
移除源 | conda config –remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ |
添加清华源 | conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ |
如果上述不成功,应当该.condarc文件,参考 | https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/ |
添加上海交大源 | conda config –add channels https://anaconda.mirrors.sjtug.sjtu.edu.cn/pkgs/free |
来源: https://mirrors.sjtug.sjtu.edu.cn/docs/anaconda | |
添加中科大源 | conda config –add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ |
添加阿里pip源 | conda config –add channels http://mirrors.aliyun.com/pypi/simple/ |
window | |
创建.condarc | conda config –set show_channel_urls yes |
pip | |
更新pip | python -m pip install –upgrade pip |
添加清华源 | pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple |
添加阿里源 | pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ |
添加腾讯源 | pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple |
poetry | poetry |
只在安装某包时使用源 | pip3 install package_name -i https://xx.mirrors |
使用回默认的Pypi源 | pip install package_name -i https://pypi.org/simple |
临时镜像 | pip install tf-nightly-gpu -i http://pypi.douban.com/simple –trusted-host pypi.douban.com |
- 这里的 -i 全称是 —index-url
debain && ubuntu¶
- ubuntu和debian不同(python:3.6用的是debian的系统) 镜像+update+clean
- 然后前面加上:
ubuntu¶
FROM ubuntu:16.04
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list && \
debian¶
RUN echo " " > /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian jessie main" >> /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian jessie-updates main" >> /etc/apt/sources.list && \
- 或者
# sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
# sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
- 来源:https://blog.csdn.net/enthan809882/article/details/104441118
- 然后结尾加上
- 默认都需要的是
apt-get -y update && \
apt-get -y upgrade
apt-get install --yes --no-install-recommends \
git && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
docker¶
- deepo的方法
- docker pull ufoym/deepo
- docker pull registry.docker-cn.com/ufoym/deepo
- 阿里云方法
- /etc/docker/daemon.json(没有时新建该文件)
- 阿里云弄镜像加速的方法: https://cr.console.aliyun.com/cn-beijing/new
- 添加如下内容(里头填写的内容需要 弄个阿里云开发账户获得?)
- 这里有其他人搞的账户
- docker pull 89fbee4e.mirror.aliyuncs.com/cortexica/openvino
- 更多其他人的账户:
"dns": ["8.8.8.8","8.8.4.4"]
而且上面的 hosts 似乎可以不用配置
"https://kfwkfulq.mirror.aliyuncs.com",
"https://2lqq34jg.mirror.aliyuncs.com",
"https://pee6w651.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
- NGC-docker
- 同样可以通过阿里云加速,不过我花了几小时从ngc上下载好了,就不搞了
- pypi 上有最新的package 但是 pip install 下载不了
- 似乎是跟我的conda环境有关系,切换了conda环境,就下载成功了,否则只能强行指定来源:
- pip install https://mirrors.aliyun.com/pypi/packages/8e/60/b975d9b5b9f7c5416e58cbff16894de259733b78031875226600438b16ad/minlp-tokenizer-3.2.3.tar.gz
poetry¶
2022-1-22: 不太清楚为什么不能 pip global 的方式?
mkdir ~/.pip && vi ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
Last update :
2023年12月4日
Created : 2023年8月4日
Created : 2023年8月4日