[英]'ModuleNotFoundError' in python venv? I definitely have the module installed in the venv
I am trying to use PIL in my project.我正在尝试在我的项目中使用 PIL。 I sourced my venv and then installed using pip3 install Pillow.
我采购了我的 venv,然后使用 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?我尝试阅读其他有类似问题的帖子,看到有人提到我可能有一个指向不同 python 位置的别名,这可能是问题所在吗? How would I resolve that?
我将如何解决?
Make sure your virtual environment is activated确保您的虚拟环境已激活
Command to activate virtual environment in linux an macOS:-在 linux 和 macOS 中激活虚拟环境的命令:-
source venv_name/bin/activate
Command to activate virtual environment in windows:-在 windows 中激活虚拟环境的命令:-
venv_name\Scripts\activate
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.