pip下载慢问题解决方案

打印 上一主题 下一主题

主题 910|帖子 910|积分 2730

在使用Python开发过程中,经常要用pip安装软件包,但是直接使用pip install packagename经常慢得要死,而且慢就算了很多时候还下载完成安装失败。
问题原因

pip默认使用的是国外源(https://pypi.org/simple),由于众所周知的原因,访问一般都会很慢。
解决方案

使用国内源。
临时方法

在命令行里面加上 -i https://pypi.tuna.tsinghua.edu.cn/simple
一劳永逸的方法

直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。(这里针对Windows系统)
  1. [global]
  2. index-url = https://pypi.tuna.tsinghua.edu.cn/simple
  3. [install]
  4. trusted-host=mirrors.aliyun.com
复制代码
国内源记录

清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/ 
豆瓣:http://pypi.douban.com/simple/

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

河曲智叟

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表