Python国内常用镜像源大全

前言

    由于网络问题,直接从Python官方的PyPI仓库下载软件包可能会遇到速度慢甚至无法访问的情况。还好,有几个国内大学和组织提供了PyPI的镜像,可以显著提高下载速度和稳定性。本文将介绍几个常用的Python镜像源,并指导如何在pip中配置它们。

国内镜像地址

  • 阿里云
  • http://mirrors.aliyun.com/pypi/simple/
    
  • 豆瓣(douban)
  • http://pypi.douban.com/simple/
    
  • 清华大学
  • https://pypi.tuna.tsinghua.edu.cn/simple/
    
  • 中国科学技术大学
  • http://pypi.mirrors.ustc.edu.cn/simple/
    
  • 腾讯
  • http://mirrors.cloud.tencent.com/pypi/simple
    

    使用方式

    临时换源

    清华源
    pip install xxxx -i https://pypi.tuna.tsinghua.edu.cn/simple
    
    阿里源
    pip install xxxx -i https://mirrors.aliyun.com/pypi/simple/
    
    腾讯源
    pip install xxxx -i http://mirrors.cloud.tencent.com/pypi/simple
    
    豆瓣源
    pip install xxxx -i http://pypi.douban.com/simple/
    
    中科院源
    pip install xxxx -i https://pypi.mirrors.ustc.edu.cn/simple/
    

    只需要把xxxx换成自己需要安装的包的名字。

    永久换源

    清华源
    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 http://mirrors.cloud.tencent.com/pypi/simple
    
    豆瓣源
    pip config set global.index-url http://pypi.douban.com/simple/
    
    中科院源
    pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/
    

    换回默认源

    pip config unset global.index-url
    

    辅助网站

    清华大学开源软件镜像站
    腾讯软件源
    阿里巴巴开源镜像站
    中国科学技术大学开源软件镜像站

    作者:hmcy-zbx

    物联沃分享整理
    物联沃-IOTWORD物联网 » Python国内常用镜像源大全

    发表回复