0

I am working in PyCharm and struggling to install/import PIL/Pillow.

I have used pip install Pillow in the terminal which returns Requirement already satisfied. However, when I try to import a PIL module such as from PIL import Image it returns that there is no module named 'PIL'.

Any ideas? Am I getting confused between PIL and Pillow?

Thanks!

bethfm
  • 1
  • 1
  • Check whether your pip and your python are the same version. `pip --version` and how you run your python + `--version`. If they don't show the same, then you gotta do whatever you use to run your python + `-m pip install pillow` (so it can be `python -m pip install pillow` or `python3 -m pip install pillow`, or `py -m pip install pillow`... that's what I'm saying "whatever you use your python" as it may vary depending on system or installation process) – h4z3 Mar 23 '22 at 13:29
  • Thanks for your reply! I have tried this but I still have the problem that there is no module named PIL even though I have installed pillow – bethfm Mar 23 '22 at 13:45
  • Do you have multiple installations of Python? – tintins7a6164 Mar 23 '22 at 13:48
  • @tintins7a6164 Possibly... How could I find out if I do have multiple versions? I'm new to this! – bethfm Mar 23 '22 at 13:58
  • You can use the command `py -0` to view the versions of the installated Python instances. To view the paths as well use `py -0p` – tintins7a6164 Mar 23 '22 at 14:00
  • Thanks @tintins7a6164, I used `python -O` and it looks like I only have the one version of python. `-p` was an unknown option. – bethfm Mar 23 '22 at 14:12
  • `python -O` is different to the `py -0` command. I should note this command is only for Windows. If you cannot seem to run the command, attempt to import the PIL module from the Python interpreter (accessing through the `python` command) – tintins7a6164 Mar 23 '22 at 16:45
  • Where did you run your pip? I just noticed the pycharm tag at the question. Pycharm by default makes virtual environments for projects made in it. You have to use pip in the console in pycharm itself or use its gui package installer – h4z3 Mar 24 '22 at 08:42

0 Answers0