The solution for Importerror no module named PIL error is installing pillow python package using various methods(pip, conda easy_isntall ). In this article, we explore various ways of installing pillow package.
Importerror no module named PIL ( Solution ) –
Lets start exploring the various ways.
1. Using pip for pillow installation –
Pip is most prominent package manager for any python package installation. Please use the below command.
pip install Pillow
As an alternative of this command, you may use the below command also.
python3 -m pip install --upgrade Pillow
2. Using Conda for installation for pillow –
Conda is the similar package manager like pip. You may use the below command for installation.
conda install -c anaconda pillow
3. Using easy_install for pillow installation –
Its another way for resolving the bug “Importerror no module named PIL ” to install the pillow package using easy_install package. Here is the simplest command.
How to verify the Solution (no module named PIL ) ?
Obviously , If you want to verify the installation, just rerun the code again. If the same error does not get replicated, It means you have code the installation correctly. But In this way, You may encounter the further bug in code, which may confuse you. So the best way to verify this bug. To run the simple line of python code, If this get run without any bug, it means the installation is successful.
from PIL import Image
In General , Pillow is useful for image processing and mostly useful in computer vision. There are couple of alternative available for pillow but pillow is the market king and the first choice for every developer/ data scientist.
I hope now you must have resolved this issue. still if you are stuck Please let us know. You may comment us or write back to us. Our Team will soon reach out to you. Thanks for reading the complete article. Please provide your suggestion.
Data Science Learner Team
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.