安装Pillow for Python的问题

时间:2017-07-19 08:40:48

标签: python pip python-imaging-library redhat pillow

我正在尝试通过pip

在我的RedHat操作系统中安装Pillow
sudo pip install Pillow

但是,我收到以下错误

You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting Pillow
/usr/lib/python2.6/sitepackages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading Pillow-4.2.1.tar.gz (12.7MB)
    100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 12.7MB 35kB/s 
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 20, in <module>
  File "/tmp/pip-build-5XOfq_/Pillow/setup.py", line 143
    required = {'jpeg', 'zlib'}
                      ^
SyntaxError: invalid syntax

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5XOfq_/Pillow

我该如何解决这个问题?

由于

2 个答案:

答案 0 :(得分:1)

您获得的错误与创建Python 2.7中引入的集的新语法有关。

{item1, item2, ...}

似乎你在2.7之前运行的是Python版本,但它并不认为这是有效的语法。

Pillow的网站包括notes on which versions of Pillow are compatible with which versions of Python。您需要升级Python(推荐),或选择适用于您的Python版本的旧版Pillow。

答案 1 :(得分:0)

http://prodiguer.github.io/synda/faq.html#transfer-module

这里说:

  

此错误影响从源安装的3.6版本(RPM 3.6和DEB   3.6不应受影响)。它已在3.7中修复。它可以通过降低pypi枕头包装来固定在3.6:

pip install pillow==3.4.2