pip 安装或更新第三方库下载慢 安装失败的解决办法

在使用pip 包管理器安装或更新第三方库的时候,由于网络问题,经常出现下载慢、超时导致安装失败,如下图所示:


pip 安装或更新第三方库下载慢 安装失败的解决办法_第1张图片
pipTimeout.png

可设置pip从国内的镜像源下载安装

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

设置方法,以清华镜像源为例:

  • 临时使用:
    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple <库名>
  • 永久设置:
    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

示例:

安装库

TsinghuaMirrorInstallLib.png

更新库
pip 安装或更新第三方库下载慢 安装失败的解决办法_第2张图片
TsinghuaMirrorUpdateLib.png


看见更大的世界,遇见更好的自己

See a better world to meet better for ourselves.


你可能感兴趣的:(pip 安装或更新第三方库下载慢 安装失败的解决办法)