I've just updated my OS and cannot import PIL. I installed Xcode after I updated my OS so that is up to date. I've seen many answers on this site refer to older versions of MAC OS X but nothing has worked for me. I installed Pillow as that was the advice given in another answer.
I installed Pillow with
brew install pillow
In my module I have
from PIL import Image
And I'm getting the error:
ModuleNotFoundError: No module named 'PIL'
You have both Python 2 and Python 3 installed.
Python 2 comes with macos. So the program python
is probably a link to python2.7
.
You didn't mentioned how you installed Python 3. If you haven't done so, it is probably easiest in the long run is to use a package manager like homebrew.
This is because an imaging library like Pillow needs certain shared libraries to work properly. Homebrew's recipes will make sure that these are installed when you install pillow.
The same goes for other useful packages like numpy
.
So, delete your Python 3 version. Install homebrew and use it to install Python 3 and pillow.