pip install PIL 报错: Could not find a version that satisfies the requirement PIL

ERROR: Could not find a version that satisfies the requirement PIL ERROR: No matching distribution found for PIL


代码如下

//pip install PIL

报错

WARNING:Retrying (total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x0416ACB0>: Failed to establish a new connection: [Error 11001] getaddrinfo failed')': /simple/pil/
WARNING:Retrying (total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x0416A490>: Failed to establish a new connection: [Error 11001] getaddrinfo failed')': /simple/pil/
WARNING:Retrying (total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x0416A690>: Failed to establish a new connection: [Error 11001] getaddrinfo failed')': /simple/pil/
WARNING:Retrying (total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x0416AC90>: Failed to establish a new connection: [Error 11001] getaddrinfo failed')': /simple/pil/
WARNING:Retrying (total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x041953B0>: Failed to establish a new connection: [Error 11001] getaddrinfo failed')': /simple/pil/
ERROR:Could not find a version that satisfies the requirement PIL
ERROR:No matching distribution found for PIL

截图如下在这里插入图片描述

在网上找了原因,说是“pip的时候各种关卡限制其网速导致网速过慢或安装失败”,也就是连接超时,所以需要自己设定安装源,照着网上的方法进行安装:

pip install PIL -i 空格,再加pip源的 url
如果还是报错,要求使用“-trusted host

国内pip源的url如下,任选一个:
阿里云:http://mirrors.aliyun.com/pypi/simple
豆瓣:http://pypi.douban.com/simple/
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple

e.g. 任选一个pip源 例如清华大学的 代码如下

//pip install PIL -i http://pypi.tuna.tsinghua.edu.cn/simple/

报错
在这里插入图片描述试着在 pip install PIL -i http://pypi.tuna.tsing.edu.cn/simple/
后再加 --trusted-host pypi.tuna.tsing.edu.cn 代码如下

//pip install PIL -i http://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn

还是报错

ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: No matching distribution found for PIL

截图如下在这里插入图片描述
又查了一下,因为 PIL 已经被 Pillow 所替代了,所以使用 pip install PIL 不行,要将其改成 pip install Pillow

//pip install Pillow -i http://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn

终于成功 截图如下在这里插入图片描述
所以最终答案 就是这行代码:

//pip install Pillow -i http://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn

希望可以帮到大家!

  • 78
    点赞
  • 74
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 13
    评论
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

没意思不好玩我不玩了

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

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

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

打赏作者

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

抵扣说明:

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

余额充值