0

I have successfully installed Pillow:

chris@MBPvonChristoph sources % python3 -m pip install --upgrade Pillow
Collecting Pillow
  Using cached Pillow-9.0.1-1-cp310-cp310-macosx_11_0_arm64.whl (2.7 MB)
Installing collected packages: Pillow
Successfully installed Pillow-9.0.1

but when I try to use it in pycharm, I got:

Traceback (most recent call last):
  File "/Users/chris/PycharmProjects/pythonProject2/main.py", line 1, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

or using it in Blender, I got:

ModuleNotFoundError: No module named 'PIL'

I am not a Python lib installing pro so obviously I did something wrong. But how do I fix that?

I am working on an M1 Macbook.

2 Answers 2

1

looks like you may need to repoint your pycharm to your installed python interpreter.


  1. go to command line and find out python interpreter path. On windows you can where python in your command line an it will give you where your python and packages are installed.. You could also activate python directly in command line and find paths from there. For example, open command line then;
python

press enter = activates python

within then you can do:

import sys
for x in sys.path: x

  1. In pycharm make sure you point to path discovered from step 1 and select that to be your python interpreter within pycharm --- check out examples here https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#add-existing-interpreter

  1. Should work. Not sure about all the steps you took, but if you installed python with pycharm on top of your regular installation of python i would recommend :
  • finding all the paths from step 1
  • deleting python using system
  • checking if folders found from paths step still exist
  • if they do, delete those as well
  • start over just with one python installation
  • repoint to that in pycharm
Sign up to request clarification or add additional context in comments.

2 Comments

i tried that and i got this from pycharm: [1]: i.sstatic.net/whDkJ.png
0

first

pip uninstall PIL

after uninstall

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow

or

brew install Pillow 

2 Comments

if i try to uninstall it says "chris@MBPvonChristoph sources % pip uninstall PIL WARNING: Skipping PIL as it is not installed."
i got the same error message as i stated in my question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.