[英]Fail to import a Module: ModuleNotFoundError: No module named 'folder'
Am try to get my head around python package and module, in a structure below in serengeti.py i import arusha module by doing from ubongo.arusha import Lake
(lake is a method in arusha module) i get an error "ModuleNotFoundError" do i need to add to PYTHONPATH.我试着了解 python package 和模块,在 serengeti.py 下面的结构中我通过
from ubongo.arusha import Lake
导入 arusha 模块(lake 是 arusha 模块中的一种方法)我收到错误“ModuleNotFoundError”我做需要添加到 PYTHONPATH。 i dont know what am doing wrong any help you can provide on my learning journey i would appreciate我不知道哪里做错了,您可以在我的学习过程中提供任何帮助,我将不胜感激
ubongo
|
__init__.py
|
arusha.py
|
manyara
|
__init__.py
|
serengeti.py
you need the ubongo parent to be the working directory or to be on PYTHOPATH.您需要将 ubongo 父级作为工作目录或位于 PYTHOPATH 上。
The former option is the better practice as messing with PYTHONPATH can make problems.前一个选项是更好的做法,因为弄乱 PYTHONPATH 会产生问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.