简体   繁体   English

ModuleNotFoundError:没有命名的模块 - Python

[英]ModuleNotFoundError: No module named - Python

Can someone please help with this error?有人可以帮忙解决这个错误吗? I have tried all sort of ways to import a module in Python but not has worked so far.我已经尝试了各种方法来在 Python 中导入模块,但到目前为止还没有奏效。 I have this directory structure below:我在下面有这个目录结构:

|__folder1:
|      |__folder1a
|          |___inner_file.py
|__outer_file.py

I want to import a Class from the outer_file.py into the inner_file.py .我想将一个类从outer_file.py导入到inner_file.py中。 However, I have been getting the error ModuleNotFoundError: No module named .但是,我一直收到错误ModuleNotFoundError: No module named

I have tried all the options in this link on GeeksforGeeks .我已经在GeeksforGeeks上尝试了此链接中的所有选项。 Thanks.谢谢。

easy简单

import sys,os
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, BASE)

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM