
次のコマンドを使用してPython Imaging Library(PIL)をインストールしようとしています。
pip install PIL --allow-unverified PIL --allow-all-external
次のエラーを参照してください。
gkhan@Gkan ~ $ pip install PIL --allow-unverified PIL --allow-all-external
Collecting PIL
PIL is potentially insecure and unverifiable.
Downloading http://effbot.org/media/downloads/PIL-1.1.7.tar.gz (506kB)
100% |████████████████████████████████| 507kB 1.5MB/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-egu_a9q6/PIL/setup.py", line 182
print "--- using Tcl/Tk libraries at", TCL_ROOT
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-egu_a9q6/PIL
答え1
システムのコマンドはpython
Python 3を実行しますが、PILのインストールスクリプトはPython 2用に書かれています。 Python 2とPython 3は2つの異なる言語です。似ているようですが互換性がありません。 1つの違いは、print
Python 3では括弧が必要ですが、Python 2では必要ありません。
これらのコマンドが利用可能な場合は、そのコマンドを実行またはpip2
置き換えpip2.7
てください。pip3
それ以外の場合、同様のことがpython2.7 /usr/bin/pip install …
機能します。
気づくこれまではpython
Python 2をお勧めします。しかし、いくつかのディストリビューション(少なくともArch Linux)では、Python 3を/usr/bin/python
。