miguel_2006
miguel_2006

Reputation: 1

How to use external libraries?

pip install pillow
>>> Requirement already satisfied: pillow in c:\users\miguel\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (8.3.1)
import pillow
>>> Traceback (most recent call last):
  File "C:\Users\Miguel\PycharmProjects\Testing\main\__init__.py", line 1, in <module>
    import pillow
ModuleNotFoundError: No module named 'pillow'

for some reason I can't use any downloaded libraries on Pycharm without getting this error. Tried searching it up but with no answers. I think it must be some sort of pathing error. any suggestions?

Upvotes: 0

Views: 125

Answers (1)

Mohit kumar
Mohit kumar

Reputation: 155

There are 2 possible answers : While the name of the package is pillow, it is a replacement for PIL and uses the PIL for the name of the base module

the usual way to use pillow is

from PIL import Image
im = Image.open("filename")
  1. Go to your IDE and make sure existing interpreter is set to python interpreter and not anaconda
  • Open up your Project Interpreter (⌘ + , on Mac).

  • At the bottom of this page you'll see the + symbol to the left of the anaconda logo. This will create a pop-up that allows you to search for available packages.

  • In this new window, search for 'Pillow'.

  • Click and Install Package.

Upvotes: 1

Related Questions