[英]Issue with Installing Pillow for Python
我正在嘗試通過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.7中引入的用於創建集的新語法有關。
{item1, item2, ...}
似乎您正在運行2.7之前的Python版本,該版本無法將其識別為有效語法。
Pillow的網站上包含有關哪些版本的Pillow與哪些Python版本兼容的注釋 。 您需要升級Python(推薦),或者選擇一個與您的Python版本兼容的舊版本的Pillow。
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.