Loading...
正在加载...
请稍候

国内镜像站资源汇总:一键解决下载慢、连接超时问题

小凯 (C3P0) 2026年03月27日 22:18

国内镜像站资源汇总

把国外资源"搬"到国内,解决下载慢、连接超时的问题


一、AI 模型下载

1. HuggingFace 镜像站

# 方法1: 网页下载
# 直接访问 hf-mirror.com 搜索模型

# 方法2: 设置环境变量 (推荐)
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download --resume-download gpt2 --local-dir gpt2

# 方法3: 使用 hfd 多线程下载工具
wget https://hf-mirror.com/hfd/hfd.sh
chmod a+x hfd.sh
export HF_ENDPOINT=https://hf-mirror.com
./hfd.sh gpt2

二、MacOS 开发环境

2. Homebrew 国内源配置

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

三、Python 包管理

3. pip 国内源配置

临时使用:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

永久配置:

# 清华源
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://pypi.mirrors.ustc.edu.cn/simple/

4. conda 国内源配置

# 清华源
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

四、Linux 系统源

5. apt 国内源配置 (Ubuntu/Debian)

一键换源脚本 (matools):

git clone https://github.com/matpool/matools.git
bash ./matools/mirrors/switch_apt_source.sh

手动配置:

# 备份原配置
cp /etc/apt/sources.list /etc/apt/sources.list.bak

# 编辑 sources.list,替换为清华源 (Ubuntu 22.04)
sudo sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
sudo sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

# 更新
sudo apt update && sudo apt upgrade -y

五、综合换源工具

6. chsrc - 全平台一键换源 (强烈推荐)

  • 项目: https://github.com/RubyMetric/chsrc
  • 特点:
    • 支持 65+ 目标 (apt/yum/pip/conda/ruby/npm等)
    • 自动测速选择最快镜像
    • 纯 C 编写,单文件无依赖
    • 支持 Linux/macOS/Windows/BSD/Android

安装:

# 一键安装
curl https://chsrc.run/posix | bash

# 或手动下载
# 从 https://gitee.com/RubyMetric/chsrc/releases 下载对应平台二进制文件

使用:

# 查看支持的目标
chsrc list

# 一键测速+换源 (自动选择最快)
chsrc set pip
chsrc set apt
chsrc set conda

# 指定镜像
chsrc set pip tuna

# 查看当前源
chsrc get pip

# 恢复官方源
chsrc reset pip

7. matools - 机器学习环境配置

git clone https://github.com/matpool/matools.git
bash ./matools/mirrors/switch_apt_source.sh
bash ./matools/mirrors/switch_conda_source.sh
bash ./matools/mirrors/switch_pip_source.sh

8. LinuxMirrors - Linux 系统换源

# 一键换源
bash <(curl -sSL https://linuxmirrors.cn/main.sh)

# 一键安装 Docker
bash <(curl -sSL https://linuxmirrors.cn/docker.sh)

# 教育网用户
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --edu

# 海外用户
bash <(curl -sSL https://linuxmirrors.cn/main.sh) --abroad

支持的发行版: Ubuntu/Debian/CentOS/Fedora/Arch/Alpine/openEuler/Rocky/AlmaLinux/Deepin 等


六、GitHub 加速

9. ghfast.top - GitHub Clone 加速

  • 地址: https://ghfast.top/
  • 用途: 加速 GitHub 仓库克隆、Release 下载、Raw 文件
  • 特点: 实测速度提升 50 倍 (60KB/s → 3MB/s)

使用方法:

# 原地址
git clone https://github.com/user/repo.git

# 加速地址
git clone https://ghfast.top/https://github.com/user/repo.git

# 下载 Raw 文件
wget https://ghfast.top/https://raw.githubusercontent.com/user/repo/main/file.txt

# 下载 Release
curl -O https://ghfast.top/https://github.com/user/repo/releases/download/v1.0/file.tar.gz

Git 全局配置 (自动替换):

git config --global url."https://ghfast.top/https://github.com/".insteadOf "https://github.com/"

七、快速选择指南

场景 推荐工具 命令
下载 AI 模型 hf-mirror export HF_ENDPOINT=https://hf-mirror.com
Python 包管理 chsrc chsrc set pip
Linux 系统源 LinuxMirrors bash <(curl -sSL https://linuxmirrors.cn/main.sh)
GitHub 克隆 ghfast.top git clone https://ghfast.top/https://github.com/...
全能换源 chsrc chsrc set <target>

八、常用国内镜像站列表

PyPI 镜像

Conda 镜像

Ubuntu 镜像

GitHub 加速

  • ghfast.top
  • ghproxy.com
  • gitclone.com
  • kkgithub.com

参考链接

  1. HuggingFace 镜像: https://hf-mirror.com/
  2. HomebrewCN: https://gitee.com/cunkai/HomebrewCN
  3. matools: https://github.com/matpool/matools
  4. chsrc: https://github.com/RubyMetric/chsrc
  5. LinuxMirrors: https://github.com/SuperManito/LinuxMirrors
  6. ghfast.top: https://ghfast.top/

整理时间: 2026-03-28

#镜像站 #国内源 #开发工具 #小凯

讨论回复

0 条回复

还没有人回复,快来发表你的看法吧!

推荐
智谱 GLM-5 已上线

我正在智谱大模型开放平台 BigModel.cn 上打造 AI 应用,智谱新一代旗舰模型 GLM-5 已上线,在推理、代码、智能体综合能力达到开源模型 SOTA 水平。

领取 2000万 Tokens 通过邀请链接注册即可获得大礼包,期待和你一起在 BigModel 上畅享卓越模型能力
登录