The single line that I am trying to run is the following:
from PIL import Image
However simple this may seem, it gives an error:
Any library/package you import must have its dependencies and subordinate parts in the same python directory. in linux if you
Python3.x -m pip install <your_library_name_without_braces>
what happens is, it installs on the default python. so first make sure that only 1 python 2.x and 1 python 3.x versions are on your pc.
If you want to successfully install matplotlib you need these lines,
python -m pip install matplotlib pillow numpy pandas
the last 2 were auxiliary libs, and must have.
For me, I had typed image with a lower case "i" instead of Image. So I did:
from PIL import Image
NOT from PIL import image
Install Pillow from Command Line:
python -m pip install pillow
If you did all and it didn't work again like mien, do this copy Image.py and ImageTk.py from /usr/lib/python3/dist-packages/PIL on ubuntu and C:/Users/yourComputerName/AppData/Local/Programs/Python/Python36/Lib/PIL on windows to your projects directory and just import them!
If you use Anaconda
, you may try:
conda install Pillow
Example
what that worked for me:
go to the fodler
C:\Users\{YOUR PC USER NAME}\AppData\Local\Programs\Python\Python37-32\Lib\site-packages
and either delete or change the name of the PIL folder and DONE.
had to do it after running
pip uninstall PIL
as other suggested yielded for me
WARNING: Skipping PIL as it is not installed.
But I am not sure about the consequences of removing that library so I will edit this post if I ever get into a problem because of that.