Python 尝试安装 PIL 时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41326387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 00:48:40  来源:igfitidea点击:

Get error when try to install PIL

pythoninstallpython-imaging-library

提问by Shira

I try to install PIL but get errors, what should I do?

我尝试安装 PIL 但出现错误,我该怎么办?

$ Command
Result
------------
$ pip install PIL

Collecting PIL
  Could not find a version that satisfies the requirement PIL (from versions: )
No matching distribution found for PIL
--------------------------------------------------------------------
$ pip install PIL  --allow-unverified PIL --allow-all-external

DEPRECATION: --allow-all-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.
DEPRECATION: --allow-unverified has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.
Collecting PIL
  Could not find a version that satisfies the requirement PIL (from versions: )
No matching distribution found for PIL

回答by maviz

You could try using Pillowinstead, which is a PIL fork:

您可以尝试使用Pillow,它是一个 PIL 叉:

pip install Pillow

To import use:

导入使用:

from PIL import Image

回答by Fomalhaut

The library PILis in Pillow. Try this:

图书馆PILPillow。尝试这个:

$ pip install Pillow

回答by apatniv

Not sure if there is a better way than this. But this may work as described in the documentation:

不确定是否有比这更好的方法。但这可能会按照文档中的描述工作:

http://www.pythonware.com/products/pil/.

http://www.pythonware.com/products/pil/

Download the source kit and extract it. Once extracted, do the following as described in the kit.

下载源工具包并解压。提取后,按照套件中的说明执行以下操作。

    $ tar xvfz Imaging-1.1.7.tar.gz
    $ cd Imaging-1.1.7
    $ python setup.py install