Python Forum
ImportError: No module named PIL
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ImportError: No module named PIL
#3
(Mar-02-2022, 02:28 PM)snippsat Wrote: Look at The right and wrong way to set Python 3 as default on a Mac
(Mar-02-2022, 02:02 PM)rudeoil18 Wrote: I installed Python 3.10.2 and installed Pillow using Homebrew...but I feel like I didn't do it correctly and have had a tough time uninstalling/reinstalling and think I've kind of messed it up.
You most test the python and pip work correctly from command line.
Also there can be be a difference with with python, python3 and pip, pip3.
Here a quick run on Windows the command is same on Mac.
So the which python and pip --version most point to same version.
Then will pip install something install to this version and if just type python(start interactive interpreter) can test that install did work
G:\div_code
λ python --version
Python 3.10.0

G:\div_code
λ which python
/c/python310/python

G:\div_code
λ pip --version
pip 21.3.1 from C:\python310\lib\site-packages\pip (python 3.10)

G:\div_code
λ pip install pillow --upgrade
Requirement already satisfied: pillow in c:\python310\lib\site-packages (9.0.1)

G:\div_code
λ python
Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>>
>>> im = Image.open('task.jpg')
>>> im.show()
Can also use py
G:\div_code
λ py --list
Installed Pythons found by py Launcher for Windows
 -3.10-64 *
 -3.9-64
 -3.7-32
 -3.6-32
 -3.4-32
 -2.7-32
* show the lasted version found.
So py will always use the lasted version found,even if OS path is messed up.
G:\div_code
λ py --version
Python 3.10.0

G:\div_code
λ py -m pip --version
pip 21.3.1 from C:\Python310\lib\site-packages\pip (python 3.10

So these are the returns that I get:

user@user-MacBook-Pro-16 ~ % pip3 --version
pip 22.0.3 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9)
user@user-MacBook-Pro-16 ~ % python3 --version
Python 3.9.10
user@user-MacBook-Pro-16 ~ % python --version
Python 2.7.18
user@user-MacBook-Pro-16 ~ % pip --version
zsh: command not found: pip

I installed Pillow using homebrew (brew install Pillow) and it seems the installation occurred correctly.

However, I am still getting the error from Pycharm:

/usr/bin/python2.7 "/Users/user/Library/Mobile Documents/com~apple~CloudDocs/NFTs/Wasted/render.py"
Traceback (most recent call last):
File "/Users/user/Library/Mobile Documents/com~apple~CloudDocs/NFTs/Wasted/render.py", line 1, in <module>
from PIL import Image
ImportError: No module named PIL
Reply


Messages In This Thread
ImportError: No module named PIL - by rudeoil18 - Mar-02-2022, 02:02 PM
RE: ImportError: No module named PIL - by snippsat - Mar-02-2022, 02:28 PM
RE: ImportError: No module named PIL - by rudeoil18 - Mar-02-2022, 02:43 PM
RE: ImportError: No module named PIL - by snippsat - Mar-02-2022, 02:58 PM
RE: ImportError: No module named PIL - by rudeoil18 - Mar-02-2022, 03:18 PM
RE: ImportError: No module named PIL - by snippsat - Mar-02-2022, 07:10 PM
RE: ImportError: No module named PIL - by rudeoil18 - Mar-02-2022, 08:01 PM
RE: ImportError: No module named PIL - by snippsat - Mar-02-2022, 11:03 PM
RE: ImportError: No module named PIL - by rudeoil18 - Mar-03-2022, 12:34 PM
RE: ImportError: No module named PIL - by snippsat - Mar-03-2022, 01:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ModuleNotFoundError: No module named 'eyed3' Wimpy_Wellington 3 3,634 May-10-2025, 05:56 PM
Last Post: Wimpy_Wellington
  ModuleNotFoundError: No module named 'tkcalendar', Thonny, Windows 10 Edward_ 4 1,220 Apr-06-2025, 07:56 PM
Last Post: Edward_
  No module named 'importlib.metadata' EdVS 3 1,264 Jan-30-2025, 09:55 AM
Last Post: Larz60+
  ModuleNotFoundError: No module named 'athena_read' raman 2 1,426 Jul-01-2024, 07:52 AM
Last Post: Gribouillis
  no module named 'docx' when importing docx MaartenRo 1 6,169 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  Problem with pymodbus - ModuleNotFoundError: No module named 'pymodbus.client.sync' stsxbel 2 31,742 Nov-02-2023, 08:20 AM
Last Post: South_east
  ModuleNotFoundError: No module named 'requests' Serg 18 11,009 Oct-29-2023, 11:33 PM
Last Post: Serg
  Resolving ImportError: No module named gdb (Python in C++) mandaxyz 3 4,810 Oct-04-2023, 02:43 PM
Last Post: mandaxyz
  ModuleNotFoundError: No module named 'PyPDF2' Benitta2525 1 4,114 Aug-07-2023, 05:32 AM
Last Post: DPaul
  How to fix this error: ModuleNotFoundError: No module named 'notears' yaoyao22 2 2,605 Jul-09-2023, 11:24 AM
Last Post: yaoyao22

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020