pip 安装 PIL 失败 [英] pip install PIL fails
问题描述
我正在尝试安装 pip 包 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))
当我有旧版本的 pip 时,安装确实有效,但使用当前版本的 pip 7.1.2
我无法下载包.我正在使用以下命令安装 pip 包
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
这有什么问题.我认为这可能是 SSL 问题,这就是我添加 --trusted-host
标志的原因.有没有办法将 --allow-external
标志与 virtualenv-reqs
文件一起使用.
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 是 PIL 的一个维护分支,所以我推荐使用 Pillow.但是您不能同时安装两者.
Pillow is a maintained fork of PIL, so I recommend using Pillow. But you can't have both installed at the same time.
首先,移除 PIL 和 Pillow.
First, remove both PIL and Pillow.
然后使用 pip install Pillow
安装 Pillow(不过,根据平台,您可能需要一些 先决条件).
Then install Pillow with pip install pillow
(although, depending on platform, you may need some prerequisites).
然后确保代码使用的是 from PIL import Image
而不是 import Image
.
Then make sure code is using from PIL import Image
rather than import Image
.
这篇关于pip 安装 PIL 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!