安装Python枕头时出现的问题

安装Python枕头时出现的问题,python,pip,python-imaging-library,redhat,pillow,Python,Pip,Python Imaging Library,Redhat,Pillow,我正试图通过pip在我的RedHat操作系统中安装枕头 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/sitep

我正试图通过pip在我的RedHat操作系统中安装枕头

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
您使用的是pip版本7.1.0,但版本9.0.1可用。
您应该考虑通过“PIP安装升级PIP”命令进行升级。
收集枕
/usr/lib/python2.6/sitepackages/pip/_供应商/requests/packages/urllib3/util/ssl.py:90:UnsecurePlatformWarning:真正的SSLContext对象不可用。这会阻止urllib3正确配置SSL,并可能导致某些SSL连接失败。有关详细信息,请参阅https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
不安全平台警告
下载枕头-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\u2588\u2588\u288 12.7MB/s
从命令python setup.py egg_info完成输出:
回溯(最近一次呼叫最后一次):
文件“”,第20行,在
文件“/tmp/pip-build-5XOfq\uq/Pillow/setup.py”,第143行
必需={'jpeg','zlib'}
^
SyntaxError:无效语法
----------------------------------------
命令“python setup.py egg_info”失败,错误代码为1,位于/tmp/pip-build-5XOfq_u/Pillow中
我如何解决这个问题


感谢您,您遇到的错误与Python 2.7中引入的用于创建集合的新语法有关

{item1, item2, ...}
看起来您运行的是Python 2.7之前的版本,它不认为这是有效的语法

枕头的网站包括。您需要升级Python(推荐),或者选择与您现有的Python版本兼容的旧版本的Pillow。

这里说:

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

pip install pillow==3.4.2

要么安装支持Python 2.6的旧版本,要么升级Python解释器。首先,请执行
pip安装--升级pip
See以获取版本对,页面的最底部告诉您如何访问旧版本下载。我已将Python升级到2.7.5,但问题仍然存在。是否可能运行的是旧版本而不是更新版本?如果是这样,如何修复它?我已经将python升级到2.7.5,但问题仍然存在。是否可能运行的是旧版本而不是更新版本?如果是这样,如何修复它?这取决于您如何升级它。运行新版本的一个简单方法是卸载旧版本,如果系统上没有任何东西需要它。(之后您可能还需要卸载并重新安装新版本。)您可以使用
pip--version
检查哪个版本正在运行。