0

I am trying to use the PIL in Python 3, but there is no way I can make it work. I tried several links, but none of them really helped. I am using Ubuntu 14.04 and installed IDLE.

Can anyone here, please help me?

Thanks in advance,

Gabs
  • 292
  • 5
  • 23
  • 1
    What did you try? How did it fail? – Tim Apr 07 '15 at 14:23
  • http://stackoverflow.com/questions/15002538/install-pil-in-ubuntu-12-04-python-2-7-and-python-3-2 - for example. The last line (python3 setup.py install) doesn't work. And (sudo aptitude install python3-pip git pip-3.2 install --user git+https://github.com/python-imaging/Pillow) also doesn't work, since it asks to remove lots of packages. – Gabs Apr 07 '15 at 14:27

1 Answers1

1
sudo apt-get install python3-pil python3-pil.imagetk

You may need to manually remove any left-overs of non-successful installs tried with pip or compiling with setup.py - this will be indicated by conflicting files listed in the error message.

The rule of thumb is: If you want a Python general tool for interactive use, or that provides scripts you will use directly, libraries for small scripts for personal use: you have to install the package built for your system (the .deb) with apt-get, aptitude whatever - unless that Python module is not packaged at all.

For all other uses, you should create a Python virtualenv and install the desired modules inside that virtualenv with pip install <name>. Including the cases Ubuntu does not have the desired Python module packaged.

Regarding PIL there is still another interesting bit: the original PIL had become unmaintained and bit-rot over the years. One of the most proeminent bugs arising from that is exactly it inability to be cleanly installed using pip or easy_install. Another one is that it never was (at least properly) ported to work with Python3. Due to that a fork named "Pillow" was created. It is a drop-in replacement for the orinal PIL - PIP and Easy_install should install "Pillow" and not "PIL".

(NB. I do not know which PIL or Pillow - is packaged by Ubuntu under the "python-pil" names. I suppose and hope it is the actively maintained project Pillow)

jsbueno
  • 99,910
  • 10
  • 151
  • 209