2

I am trying to install PIL (the Python Imaging Library) using the command:

pip install PIL  --allow-unverified PIL --allow-all-external

seeing the following errors:

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
1

The python command on your system runs Python 3, but the setup script for PIL is written for Python 2. Python 2 and Python 3 are two different languages; they look a lot like each other but they aren't compatible, and one of the differences is that print requires parentheses in Python 3 but not in Python 2.

Run pip2 or pip2.7 instead of pip3 if these commands are available. Otherwise something like python2.7 /usr/bin/pip install … should work.

Note that so far, it is recommended for python to be Python 2 but a minority of distributions (Arch Linux at least) install Python 3 as /usr/bin/python.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.