2017-07-19 33 views
0

我試圖通過PIP在我的RedHat操作系統安裝枕頭問題與Python的

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 

我怎樣才能解決這個問題?

感謝

+0

要麼安裝支持Python 2.6的舊版Pillow版本,要麼升級Python解釋器。 – bakatrouble

+0

首先執行'pip install --upgrade pip' – Ludisposed

+0

請參閱https://pillow.readthedocs.io/en/4.2.x/installation.html#notes for version-pairs,並在頁面底部講述訪問較舊的下載。 – tevemadar

回答

1

你得到的錯誤與用於創建是在Python 2.7引入了套新的語法做。

{item1, item2, ...} 

看來你運行的是2.7之前的Python版本,它並不認爲這是有效的語法。

枕頭的網站包括notes on which versions of Pillow are compatible with which versions of Python。您需要升級Python(推薦),或者選擇適用於您的Python版本的舊版Pillow。

+0

我已將python升級到2.7.5,但問題仍然存在。舊版本可能運行而不是更新的版本?如果是這樣,如何解決它? – halahmadi

+0

這取決於你如何升級它。使新版本運行的一種萬無一失的方法是卸載舊版本,如果系統上沒有任何需要它的話。 (之後,您可能需要卸載並重新安裝新版本。)您可以使用'pip --version'來檢查正在運行的版本。 –