How to remove PIL for python 2.7 and use Pillow instead?

I apologize if this is not a place for publication. I was looking for a watch and cannot find anything, so I thought I would ask here. If this is not the right place to post this, please someone can point me in the right direction, thanks!

So my problem is with PIL and Pillow. I need to use python 2.7 since I am using SimpleCV which is not yet supported in python 3.

When I try to remove PIL using sudo pip uninstall PIL , it gives out: Cannot uninstall requirement PIL, not installed .

This works for python 3 and allows you to use Pillow with from PIL import Image . If I try to use import Image , I get an error because it does not exist, but for python 2.7 (the version I need to use), both works from PIL import Image and import Image make me believe that PIL was not deleted from python 2.7?

Did I understand correctly that it was not removed for python 2.7? If so, how to remove it? Or am I mistaken in thinking about this? If so, what can I do?

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

Just in case, this is important, I use raspberry pi.

+5
source share
1 answer

I suspect you have successfully uninstalled PIL, and you actually have Pillow installed. The pillow is installed under the name of the PIL package. This allows you to change Pillow with PIL without having to rewrite any of your codes. A pillow is a β€œsimple” PIL plug.

You can check if import PIL really loads the pad by doing:

 import PIL print PIL.PILLOW_VERSION 

If you have Pillow installed, it should output some version. It says 3.3.1 here, but I'm using Python3. If you do not have a pillow but PIL, this should lead to an error.

+6
source

Source: https://habr.com/ru/post/1260368/


All Articles