I am importing Image, ImageTk using from PIL import Image, ImageTk
I get the error that the module doesnt exist, but when I try to install it, it says that the module is already installed.
I get this error:
from PIL import Image, ImageTk
ModuleNotFoundError: No module named 'PIL'
When I try to import pillow using pip install pillow
I get the following message.
Requirement already satisfied: pillow in c:usersadminappdatalocalpackagespythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0localcachelocal-packagespython310site-packages (9.2.0)
This is on VS code, so I suspect the python interpreter.
2
Answers
I hope this will help you:
👇️ Before installing Pillow, uninstall PIL.
pip uninstall PIL
👇️ in a virtual environment or using Python 2
pip install Pillow
👇️ for python 3 (could also be pip3.10 depending on your version)
pip3 install Pillow
👇️ if you get permissions error
sudo pip3 install Pillow
pip install Pillow –user
👇️ if you don’t have pip in your PATH environment variable
python -m pip install –upgrade Pillow
👇️ for python 3 (could also be pip3.10 depending on your version)
python3 -m pip install –upgrade Pillow
👇️ using py alias (Windows)
py -m pip install –upgrade Pillow
👇️ for Anaconda
conda install -c conda-forge pillow
👇️ for Jupyter Notebook
!pip install Pillow
Make sure that the interpreter environment you are currently using and the interpreter environment where the pillow package is installed are the same.
Ctrl+Shift+P –>
Python:Select Interpreter
Choose the right interpreter