简体   繁体   English

导入模块:ModuleNotFoundError:没有模块命名

[英]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.

相关问题 Scrapy ModuleNotFoundError:没有名为“import”的模块 - Scrapy ModuleNotFoundError: No module named "import" 导入模块失败:ModuleNotFoundError:没有名为“文件夹”的模块 - Fail to import a Module: ModuleNotFoundError: No module named 'folder' ModuleNotFoundError:没有命名的模块<module>在 importlib 上 import_module</module> - ModuleNotFoundError: No module named <module> on importlib import_module 传递导入错误:ModuleNotFoundError:没有名为'...'的模块 - Transitive import error: ModuleNotFoundError: No module named '…' 导入火炬 ModuleNotFoundError: 没有名为“火炬”的模块 - import torch ModuleNotFoundError: No module named 'torch' 无法导入 PIL ModuleNotFoundError: No module named &#39;PIL&#39; - can not import PIL ModuleNotFoundError: No module named 'PIL' Python导入ModuleNotFoundError:没有名为“模型”的模块 - Python import ModuleNotFoundError: No module named 'model' 将 pandas 导入为 pd ModuleNotFoundError:没有名为“pandas”的模块 - import pandas as pd ModuleNotFoundError: No module named 'pandas' 导入_winapi ModuleNotFoundError:没有名为“_winapi”的模块 - import _winapi ModuleNotFoundError: No module named '_winapi' scrapy import itemloaders ModuleNotFoundError:没有名为“itemloaders”的模块 - scrapy import itemloaders ModuleNotFoundError: No module named 'itemloaders'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM