常用镜像源 | Anaconda, pip, git clone等

随笔4小时前发布
5 0 0

最近在一台受限的Ubuntu上配置和使用开源项目。由于该服务器暂时无法访问墙外网站,故找了很多镜像网站作为替代

1. pip(pypi) 清华镜像源

https://pypi.tuna.tsinghua.edu.cn/simple
使用方法:
终端命令

pip install 包名 -i https://pypi.tuna.tsinghua.edu.cn/simple

2. Anaconda 下载清华镜像源

https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
使用方法(Linux)

wget  https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2024.06-1-Linux-x86_64.sh

如果wget not found则先安装

sudo apt install wget

如果403 Forbidden则加上User-Agent

wget -U 'Mozilla' https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2024.06-1-Linux-x86_64.sh

(参考[[https://www.cnblogs.com/haoliyou/p/17666790.html|此篇]])

3. GitHub 镜像源

https://gitclone.com
https://kkgithub.com
使用方法:在镜像网站找到对应代码仓库,复制地址

git clone 镜像地址

4. 更新submodule

有的项目会包含子模块需要更新,找到.gitmodule文件,将其中url = https://github.com/XXX/XXX.git改为
url = https://kkgithub.com/XXX/XXX.git
或者在本地更新完后上传

5. HuggingFace 镜像

原址常见错误: connectionerror: HTTPSConnectionPool(host='huggingface.co', port=443): Read timed out.
镜像地址 https://hf-mirror.com
换源方法(对于一些国外的开源项目无需手动更改代码):

pip install -U huggingface_hub
export HF_ENDPOINT=https://hf-mirror.com

(更多有关HuggingFace模型下载内容,可以参考[[https://zhuanlan.zhihu.com/p/663712983|这篇]])

5. conda install 增加国内镜像源

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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud//pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes

参考自https://www.cnblogs.com/fireblackman/p/16422750.html

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...