菜鸟-创作你的创作

python国内镜像下载

明白了,你是想在国内下载 Python 及相关包,希望加速,使用国内镜像源。这里我给你整理最完整的指南,包括 Python 官方安装和 pip 国内镜像


一、Python 官方下载(国内镜像加速)

1️⃣ 官方推荐安装

镜像站说明链接
清华大学 TUNA 镜像国内速度快https://mirrors.tuna.tsinghua.edu.cn/python/
中科大 USTC 镜像国内速度快https://mirrors.ustc.edu.cn/python/
华为开源镜像国内加速https://mirrors.huaweicloud.com/repository/python/

例如,你可以访问清华镜像:https://mirrors.tuna.tsinghua.edu.cn/python/
然后选择 Python 版本(Windows / macOS / Linux)下载安装。


二、pip 国内镜像加速

Python 包管理器 pip 下载包在国内经常慢,可以使用国内镜像:

1️⃣ 临时使用(单次命令)

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

-i 指定镜像地址

2️⃣ 永久修改 pip 配置

Windows

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

Linux / macOS

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

以后用 pip install xxx 就会自动使用清华镜像下载,速度快很多。


三、国内常用 Python 镜像源列表

镜像URL说明
清华大学 TUNAhttps://pypi.tuna.tsinghua.edu.cn/simple速度快,更新及时
中科大 USTChttps://pypi.mirrors.ustc.edu.cn/simple稳定、更新及时
豆瓣 Doubanhttps://pypi.doubanio.com/simple/曾经很常用,但 2022 后部分包更新慢
阿里云https://mirrors.aliyun.com/pypi/simple/国内大厂镜像
华为开源镜像https://mirrors.huaweicloud.com/repository/pypi/simple国内速度快

四、Python 国内安装小技巧

  1. 优先用官方安装包 + 国内镜像加速 pip
  2. Windows 可选“Add Python to PATH”,方便命令行使用
  3. 推荐安装 Anaconda 或 Miniconda,国内镜像也可配置 conda 镜像:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes


💡 总结:


退出移动版