pip安装PIL失败 [英] pip install PIL fails

查看:961
本文介绍了pip安装PIL失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装pip包PIL。但是安装不起作用,导致以下错误。

 找不到满足要求pil的版本(从xhtml2pdf = = 0.0.4- -r virtualenv-reqs.txt(第16行))(从版本:)
某些外部托管的文件被忽略,因为对它们的访问可能不可靠(使用--allow-external pil允许)。
找不到匹配的发布pil(从xhtml2pdf == 0.0.4-> -r virtualenv-reqs.txt(第16行))

当我有一个较旧版本的pip,但是当前版本的pip 7.1.2 我是无法下载包。我正在使用以下命令安装pip包

  pip install --timeout = 1000 -i http:// pypi。 ksjc.sh.colo / simple --trusted-host pypi.ksjc.sh.colo -r virtualenv-reqs.txt 

这是什么问题。我认为这可能是一个SSL问题,这就是为什么我添加了 - 信任主机标志。有没有办法使用 - allow-external 标志与 virtualenv-reqs 文件一起使用。 p>

解决方案

枕头是PIL的维护叉,所以我建议使用枕头。但是你不能同时安装两个。


  1. 首先,删除PIL和Pillow。


  2. 然后安装Pillow with pip install pillow (虽然根据平台的不同, a href =https://pillow.readthedocs.org/installation.html =noreferrer>先决条件)。


  3. 然后确保代码使用PIL导入图像而不是导入图片



I am trying to install the pip package PIL. However the install doesn't work throwing the following error.

Could not find a version that satisfies the requirement pil (from xhtml2pdf==0.0.4->-r virtualenv-reqs.txt (line 16)) (from versions: )
  Some externally hosted files were ignored as access to them may be unreliable (use --allow-external pil to allow).
No matching distribution found for pil (from xhtml2pdf==0.0.4->-r virtualenv-reqs.txt (line 16))

The install does work when I have an older version of pip, but with the current version of pip 7.1.2 I am not able to download the package. I am using the following command to install the pip packages

pip install --timeout=1000 -i http://pypi.ksjc.sh.colo/simple --trusted-host pypi.ksjc.sh.colo -r virtualenv-reqs.txt

What is the issue with this. I thought it might be an SSL issue which is why I added the --trusted-host flag. Is there any way to the --allow-external flag to be used with the virtualenv-reqs file.

解决方案

Pillow is a maintained fork of PIL, so I recommend using Pillow. But you can't have both installed at the same time.

  1. First, remove both PIL and Pillow.

  2. Then install Pillow with pip install pillow (although, depending on platform, you may need some prerequisites).

  3. Then make sure code is using from PIL import Image rather than import Image.

这篇关于pip安装PIL失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆