尝试安装PIL时出错

时间:2016-12-26 04:19:25

标签: python install python-imaging-library

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

3 个答案:

答案 0 :(得分:51)

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

pip install Pillow

导入使用:

from PIL import Image

答案 1 :(得分:4)

图书馆PIL位于Pillow。试试这个:

$ pip install Pillow

答案 2 :(得分:1)

不确定是否有比这更好的方法。但这可能会如文档中所述:

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

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

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