Try to import
It to be imported
It didn't import
from PIL import Image
Traceback (most recent call last):
File "droptest.py", line 1, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
How did you install Pillow?
What do you see for pip install pillow?
C:\>pip install pillow
Collecting pillow
Using cached https://files.pythonhosted.org/packages/ae/96/6f83deebfcd20a5d4ad35e4e989814a16559d8715741457e670aae1a5a09/Pillow-6.1.0-cp37-cp37m-win_amd64.whl
Installing collected packages: pillow
Successfully installed pillow-6.1.0
Does from PIL import Image work after running that?
What output do you see when you run these?
pip --version
python --version
python -m PIL
No from PIL import image doesn't work either
pip 19.2.1
Python 3.7.4
No module named PIL
It sounds like you have more than one Python installed, and pip is installing to a different place than the one your python is using.
When I run pip --version on macOS, it shows the install path like this:
$ pip --version
pip 19.2.2 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
Does the Windows version show anything like that?
And how about with the verbose -v switch?
pip install pillow -v
python -v -m PIL
The -v stuff worked. So strange. I never had that problem before.
Thanks Hugovk.
The -v stuff worked. So strange. I never had that problem before.
Thanks Hugovk.
The -v stuff worked. So strange. I never had that problem before.
Thanks Hugovk.
I lied it's still saying it's not loaded when ran outside of the environment.
What do you mean by "ran outside of the environment"?
Please copy and paste the output of:
pip install pillow -v
python -v -m PIL
It says I have 2 versions o python like you said, One from Visual studios. but I removed that one awhile ago and this is the ONLY package that i downloaded that didn't work.
Fatal error in launcher: Unable to create process using '"c:\program files (x86)\microsoft visual studio\shared\python37_64\python.exe" "C:\Users\burnr\AppData\Roaming\Python\Python37\Scripts\pip.exe" install pillow -v'
Ok so I suffered from this problem
and here's what i discovered
its a virtualenv error
when I run
pip install pillow
python dosen't install pillow into my /env_name/lib/site-packages directory (using a windows machine )
thats why PIL is not recognizied
what I did is
I installed pillow globally (outside of a virtualenv )
I went into python directory itself
went into /lib/site-packages
and I found two folders :
pillow and PIL
I copied this two folders into my virtualenv exactly into env_name/lib/site-packages
and baam! problem solved
Ok so I suffered from this problem
and here's what i discovered
its a virtualenv error
when I run
pip install pillow
python dosen't install pillow into my /env_name/lib/site-packages directory (using a windows machine )
thats why PIL is not recognizied
what I did is
I installed pillow globally (outside of a virtualenv )
I went into python directory itself
went into /lib/site-packages
and I found two folders :
pillow and PIL
I copied this two folders into my virtualenv exactly into env_name/lib/site-packages
and baam! problem solved
care to elaborate e little bit
Name: Pillow
Version: 7.2.0
Location: c:\users\benga\appdata\local\programspythonpython37lib\site-packages
sys.path = [
'C:\Users\benga\Dropbox\python\snapshop',
'C:\Users\benga\AppData\Local\Programs\Python\Python37\python37.zip',
'C:\Users\benga\AppData\Local\Programs\Python\Python37\DLLs',
'C:\Users\benga\AppData\Local\Programs\Python\Python37\lib',
'C:\Users\benga\AppData\Local\Programs\Python\Python37',
'C:\Users\benga\AppData\Roaming\Python\Python37\site-packages',
'C:\Users\benga\AppData\Local\Programs\Python\Python37\lib\site-packages',
]
USER_BASE: 'C:\Users\benga\AppData\Roaming\Python' (exists)
USER_SITE: 'C:\Users\benga\AppData\Roaming\Python\Python37\site-packages' (exists)
location of my file: C:\Users\benga\Dropboxpython\snapshop
how do i run my file? i press run on vscode
import PIL.Image, PIL.Image.Tk
i get
PS C:\Users\benga\Dropbox\python\snapshop> & C:/Users/benga/AppData/Local/Programs/Python/Python37/python.exe c:/Users/benga/Dropbox/python/snapshop/tesTraceback (most recent call last):
import PIL.Image, PIL.Image.Tk
ModuleNotFoundError: No module named 'PIL.Image.Tk'; 'PIL.Image' is not a package
:(((((((((
@danielcovaci You probably meant ImageTk not Image.Tk:
from PIL import Image
from PIL import ImageTk
If there's still a problem, please open a new issue.
@danielcovaci You probably meant
ImageTknotImage.Tk:from PIL import Image from PIL import ImageTkIf there's still a problem, please open a new issue.
if the answer to my problem is this i will trow my laptop out on the window
and yes, you are right, i have copied my code import PIL.Image, PIL.ImageTk with a typo, and for two days i was trying to fix may python environment to fix the error .... thanks you saved the day!!!