简体   繁体   中英

Problem regarding Installation of Pillow for PyCharm

I am a beginner at coding and am facing a problem regarding installation of Pillow module. I firstly installed pip from PyCharm itself. Then I installed Pillow from cmd using following code:

python -m pip install pip and then python -m pip install Pillow

Both times i got a message Requirement already satisfied. So that means the modules i want to install are already installed on my PC. However when i try to import the module in PyCharm, it gives me a ModuleNotFoundError: No module named 'PIL'

when i import

from PIL import ImageTk, Image

What do I do now to use the module in my code?

PS The path directory shown in cmd when i install Pillow is actually not available in my PC.

c:/Users/< My name >/appdata/....

There is no folder named 'appdata' in there.

Go to File > Settings > Project Settings > Project Interpreter > Python Interpreters

Click on the + sign on the right side. set your python path for PyCharm

Open a command line, then go to your project directory, then type:

venv\Scripts\activate

to start the activation of the venv (virtual environment which stores its own python installation). Then just install Pillow with pip again

pip install Pillow

if you have no pip in your venv you need to install it there too: Download get-pip.py

python get-pip.py

or you can just install the Pillow module over PyCharm: https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html#

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM