解决python使用pip安装下载库出现错误:ERROR:Cannot unpack file xxxx情况

解决python使用pip安装下载库出现错误:ERROR:Cannot unpack file xxxx情况

  以scipy库下载安装为例,在命令行中直接输入命令:pip install scipy 如果下载速度很慢,或者下载失败,建议使用国内源下载。
使用清华大学镜像源下载,输入命令:pip install https://pypi.tuna.tsinghua.edu.cn/simple/scipy
详细可以参考:解决pip下载慢问题
如果出现:ERROR:Cannot unpack file的情况,如下图所示:
在这里插入图片描述
解决方法:使用命令:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn module_name 即可。
使用scipy库进行示例:
在这里插入图片描述
等待下载完成,显示安装成功。
在这里插入图片描述
如果上面镜像源没有,可以尝试其他国内源。
常用国内镜像源
 阿里云 http://mirrors.aliyun.com/pypi/simple/
 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
 豆瓣 http://pypi.douban.com/simple/

原文地址:https://www.cnblogs.com/zhicungaoyuan-mingzhi/p/12486162.html