简体   繁体   中英

'ModuleNotFoundError' in python venv? I definitely have the module installed in the venv

I am trying to use PIL in my project. I sourced my venv and then installed using pip3 install Pillow. I verified that the module is in fact installed but yet I am still getting the error.

pip3 list                                                                      
Package    Version
---------- -------
asgiref    3.5.2
Django     4.1.1
Pillow     9.2.0
pip        22.2.2
setuptools 63.4.3
six        1.16.0
sqlparse   0.4.3
(env) mike@Mikes-MacBook-Air test_app % /Users/mike/.pyenv/versions/3.9.2/bin/python /Users/mike/Desktop/bank_app/main.py
Traceback (most recent call last):
  File "/Users/mike/Desktop/bank_app/main.py", line 3, in <module>
    from PIL import Image, ImageTk
ModuleNotFoundError: No module named 'PIL'

I've tried reading through other posts with similar issues and saw someone mention that I could have an alias that is pointing to a different python location, could that be the issue? How would I resolve that?

Make sure your virtual environment is activated

Command to activate virtual environment in linux an macOS:-

source venv_name/bin/activate

Command to activate virtual environment in windows:-

venv_name\Scripts\activate

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