简体   繁体   English

安装Python枕头的问题

[英]Issue with Installing Pillow for Python

I am trying to install Pillow in my RedHat operating system through pip 我正在尝试通过pip在RedHat操作系统中安装Pillow

sudo pip install Pillow

However, I receive the following error 但是,我收到以下错误

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

How can I address this? 我该如何解决?

Thanks 谢谢

The error you're getting has to do with the new syntax for creating sets that was introduced in Python 2.7. 您遇到的错误与Python 2.7中引入的用于创建集的新语法有关。

{item1, item2, ...}

It seems you're running a version of Python prior to 2.7, which doesn't recognize this as valid syntax. 似乎您正在运行2.7之前的Python版本,该版本无法将其识别为有效语法。

Pillow's web site includes notes on which versions of Pillow are compatible with which versions of Python . Pillow的网站上包含有关哪些版本的Pillow与哪些Python版本兼容的注释 You'll need to either upgrade Python (recommended), or choose an older version of Pillow which works with the Python version you have. 您需要升级Python(推荐),或者选择一个与您的Python版本兼容的旧版本的Pillow。

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

here says: 这里说:

This bug affects 3.6 version installed from source (RPM 3.6 and DEB 3.6 should not be affected). 此错误影响从源安装的3.6版本(不应影响RPM 3.6和DEB 3.6)。 It has been fixed in 3.7. 它已在3.7中修复。 It can be fixed in 3.6 by downgrading the pypi pillow package: 可以通过降级pypi枕头包将其固定在3.6中:

 pip install pillow==3.4.2 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM