gpt4 book ai didi

python - ImportError : No module named test. session 处理程序

转载 作者:太空宇宙 更新时间:2023-11-04 01:33:57 25 4
gpt4 key购买 nike

嘿, friend 们,我将我的 python 路径设置为

/home/rohit/test

这是我的测试文件夹的结构

test/
__init__.py
meetinghandler/
__init__.py
meetinghandler.py
db/
__init__.py
models.py
setting.py
manage.py

我的问题是当我尝试导入时

from test.meetinghandler import meetinghandler   

来自模型.py 我收到错误即;

ImportError: No module named test.meetinghandler

请帮我找出我做错了什么。

最佳答案

from test import meetinghandler 查找 test 模块,它不会在您的 python 路径中找到。

原因是什么?您将 /home/rohit/test/ 添加到您的 python 路径,但该目录本身并不包含 test 目录:-) Python 在路径中查找模块,这就是为什么。

在您的情况下,您必须将主目录添加到 python 路径才能找到它。 (或者更好的是,谷歌搜索 virtualenv 等)。

关于python - ImportError : No module named test. session 处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11555128/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com