使用pip/pip3安装第三方模块,出现Cannot unpack file xxx的问题的解决以及pip安装速度慢或出现readtime out问题的解决。

16 篇文章 0 订阅

本方法应该适应于mac和linux和windows,因为我mac上是有多个版本的,所以我在使用pip3,大家灵活搭配.

1.使用常规方法安装模块

pip3 install requests

2.显示time_out,也就是超时,这种问题,一般用国内源就好了.我使用的是豆瓣源.

pip3 install https://pypi.doubanio.com/simple/ requests

但是使用这种方法提示:

Cannot unpack file /private/var/folders/3n/vbc9phdd7k1fsdj1p4x90kzw0000gn/T/pip-unpack-cf6vtali/simple.htm (downloaded from /private/var/folders/3n/vbc9phdd7k1fsdj1p4x90kzw0000gn/T/pip-req-build-6mac1w3c, content-type: text/html); cannot detect archive format

Cannot determine archive format of /private/var/folders/3n/vbc9phdd7k1fsdj1p4x90kzw0000gn/T/pip-req-build-6mac1w3c

附上终端显示情况:

翻找了一下解决方案,最终用以下方案搞定:

别人的解决方案是使用的清华源:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn requests

但是经过使用它又会报错:

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/3.7/site-packages/certifi'

Consider using the `--user` option or check the permissions.

于是给它前面添加sudo最高权限

sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn requests

完美安装.

经过分析发现主要是其--trusted-host解决的问题

也就是说可以这么使用

sudo pip3 install --trusted-host https://pypi.doubanio.com/simple/ requests

完美解决

 

  • 4
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

学渣王菜菜

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值