Conor Conor - 1 year ago 161
Python Question

How do I uninstall PIL for python 2.7 and use Pillow instead?

I'm sorry if this is the wrong place to post. I have been searching for hours and can't find anything so I thought I'd ask here. If this isn't the correct place to post this, please can someone point me in the right direction, thanks!

So my issue is with PIL and Pillow. I need to use python 2.7 as I'm using SimpleCV which isn't supported in python 3 yet.

When I try to uninstall PIL using

sudo pip uninstall PIL
it outputs:
Cannot uninstall requirement PIL, not installed

This works for python 3 and allows me to use Pillow using
from PIL import Image
. If I try to use
import Image
I get an error because it doesn't exist however, for python 2.7 (the version I need to use), both
from PIL import Image
import Image
work making me believe PIL hasn't been uninstalled from python 2.7?

Am I correct in thinking that it hasn't been uninstalled for python 2.7? If so how do I uninstall it? Or, am I wrong in thinking that? If so, what can I do?

Thanks in advance and sorry again if this is the wrong place - just not sure what to do..

Just in case it matters, I'm using a Raspberry Pi.

Answer Source

I suspect you have successfully uninstalled PIL, but have Pillow installed. Pillow is installed under the namespace PIL to you can swap out Pillow with PIL without having to rewrite any of your code. Pillow is "just" a PIL work.

You can check if import PIL actually loads Pillow by doing:

import PIL

If you have Pillow installed it should output some version. It says 3.3.1 here, but I am using Python3. If you do not have Pillow, but PIL, it should result in an error.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download