【问题标题】:Issue with Installing Pillow for Python为 Python 安装 Pillow 的问题
【发布时间】:2017-07-19 08:40:48
【问题描述】:

我正在尝试通过 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

我该如何解决这个问题?

谢谢

【问题讨论】:

  • 要么安装支持 Python 2.6 的旧 Pillow 版本,要么升级 Python 解释器。
  • 首先做pip install --upgrade pip
  • 请参阅pillow.readthedocs.io/en/4.2.x/installation.html#notes 了解版本对,页面最底部会介绍如何访问旧版下载。
  • 我已经将python升级到2.7.5,但是问题依旧存在。是否有可能运行的是旧版本而不是更新版本?如果有,如何解决?

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


【解决方案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。

【讨论】:

  • 我已经将python升级到2.7.5,但是问题依旧存在。是否有可能运行的是旧版本而不是更新版本?如果有,如何解决?
  • 这取决于你如何升级它。使新版本运行的一种万无一失的方法是卸载旧版本,如果您的系统上没有任何东西需要它。 (之后您可能还需要卸载并重新安装新版本。)您可以使用pip --version 检查正在运行的版本。
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 2018-08-22
    • 1970-01-01
    • 1970-01-01
    • 2017-01-03
    • 1970-01-01
    • 1970-01-01
    • 2022-08-15
    • 2016-08-17
    • 2015-12-06
    相关资源
    最近更新 更多