解决:Python通过pip安装库时报错:ERROR: Cannot unpack file …; ERROR: Cannot determine archive format of …
背景
在使用之前的代码时,报错:
ERROR: Cannot unpack file C:\Users\Matcha\AppData\Local\Temp\pip-unpack-qdrm7q1e\simple.htm (downloaded from C:\Users\Matcha\AppData\Local\Temp\pip-req-build-xkgrt0zv, content-type: text/html); cannot detect archive format ERROR: Cannot determine archive format of C:\Users\Matcha\AppData\Local\Temp\pip-req-build-xkgrt0zv
报错问题
ERROR: Cannot unpack file C:\Users\Matcha\AppData\Local\Temp\pip-unpack-qdrm7q1e\simple.htm (downloaded from C:\Users\Matcha\AppData\Local\Temp\pip-req-build-xkgrt0zv, content-type: text/html); cannot detect archive format ERROR: Cannot determine archive format of C:\Users\Matcha\AppData\Local\Temp\pip-req-build-xkgrt0zv
报错截图如下:
报错翻译
主要报错信息内容翻译如下所示:
ERROR: Cannot unpack file C:\Users\Matcha\AppData\Local\Temp\pip-unpack-qdrm7q1e\simple.htm (downloaded from C:\Users\Matcha\AppData\Local\Temp\pip-req-build-xkgrt0zv, content-type: text/html); cannot detect archive format ERROR: Cannot determine archive format of C:\Users\Matcha\AppData\Local\Temp\pip-req-build-xkgrt0zv
翻译:
错误:无法解压缩文件 C:\Users\Matcha\AppData\Local\Temp\pip-unpack-qdrm7q1e\simple.htm(从 C:\Users\Matcha\AppData\Local\Temp\pip-req-build-xkgrt0zv 下载,内容类型:text/html);无法检测存档格式错误:无法确定 C:\Users\Matcha\AppData\Local\Temp\pip-req-build-xkgrt0zv
报错原因
经过查阅资料,发现是网络问题或者使用的源不对。
注意:部分国外源国内不能正常访问。
小伙伴们按下面的解决方法即可解决!!!
解决方法
要解决这个错误,需要使用国内源,本文以清华源为例
使用命令:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 包名
效果截图如下
附,国内常用的源:
由于受到网络影响,国外的网站一般要比国内的网站网速慢,有时候不能正常访问,影响安装速度。所以可以使用国内的源安装,常用的源如下文章来源:https://www.toymoban.com/news/detail-764915.html
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
今天的分享就到此结束了
文章来源地址https://www.toymoban.com/news/detail-764915.html
到了这里,关于解决:Python通过pip安装库时报错:ERROR: Cannot unpack file ...; ERROR: Cannot determine archive format of ...的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!