尝试安装 PIL 时出错

Get error when try to install PIL

我尝试安装 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

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

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

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

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

您可以尝试使用 Pillow,这是一个 PIL 分支:

pip install Pillow

导入使用:

from PIL import Image

图书馆 PILPillow。试试这个:

$ pip install Pillow