I want to write a little app to convert some images.
I think to have to use Image.open()
, so I have to import the Image
module. Right?
If so, here my problem. I have read other questions like this but any of them worked for me. I tried:
import Image
=> ImportError: cannot import name 'VERSION'
from PIL import Image
=> ImportError: cannot import name 'VERSION'
from Pillow import Image
=> ImportError: No module named 'Pillow'
In documentation I read:
Pillow and PIL cannot co-exist in the same environment. Before installing Pillow, please uninstall PIL.
Pillow >= 1.0 no longer supports “import Image”. Please use “from PIL import Image” instead.
In my virtual enviroment I had PIL and Pillow directory but pip list
gave only Pillow (3.1.0) so, even reading other answers, I try to uninstall PIL using pip but it can't find PIL, so I just delete the directory PIL and installed Pillow-PIL (now it appears on pip list
and there's the directory Pillow_PIL
on my venv\Lib\site-packages\
) now:
import Image
=> ImportError: No module named 'PIL'
from PIL import Image
=> ImportError: No module named 'PIL'
from Pillow import Image
=> ImportError: No module named 'Pillow'
from Pillow-PIL import Image
=> SyntaxError: invalid syntax
(on the minus sign)
from Pillow_PIL import Image
=> ImportError: No module named 'Pillow_PIL'
apt-get install python-imaging
=> "apt-get"
command unknow (my free translation)
So, what now?
Edit: full error is
Traceback (most recent call last):
File "prova.py", line 1, in <module>
import Image
File "D:\Python\Envs\possedimenti\lib\site-packages\Image.py", line 1, in <mod
ule>
from PIL.Image import *
File "D:\Python\Envs\possedimenti\lib\site-packages\PIL\Image.py", line 29, in
<module>
from PIL import VERSION, PILLOW_VERSION, _plugins
ImportError: cannot import name 'VERSION'