简体   繁体   中英

Issue with Installing Pillow for Python

I am trying to install Pillow in my RedHat operating system through pip

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.

{item1, item2, ...}

It seems you're running a version of Python prior to 2.7, which doesn't recognize this as valid syntax.

Pillow's web site includes notes on which versions of Pillow are compatible with which versions of Python . You'll need to either upgrade Python (recommended), or choose an older version of Pillow which works with the Python version you have.

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). It has been fixed in 3.7. It can be fixed in 3.6 by downgrading the pypi pillow package:

 pip install pillow==3.4.2 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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