[英]Import Module : ModuleNotFoundError: No module named
I have the following folder strucutre.我有以下文件夹结构。 When I run createdb.py, I get the following:
当我运行 createdb.py 时,我得到以下信息:
from wrapper.utils import ymlconfig
ModuleNotFoundError: No module named 'wrapper'
Root
|-- wrapper
| |-- utils
| | `-- ymlutils.py
| | `-- __init__.py
| |-- __init__.py
| `-- jobs
|-- execute
`-- createdb.py
I was able to resolve this by我能够通过
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import wrapper
from wrapper.utils import ymlconfig
Thank you all !谢谢你们 !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.