pip下载慢问题解决方案,问题原因pip默认使


在使用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系统)

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
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/

本文来自博客园,作者:Arthurian,转载请注明原文链接:https://www.cnblogs.com/Arthurian/p/16612448.html

欢迎邮件交流:zhuanxinxin@aliyun.com

评论关闭