我有这样一个结构:
.
├── __init__.py
├── folder1
│ ├── __init__.py
│ └── file_will_import.py
└── folder2
├── __init__.py
└── helper.py
文件\u将_导入.py包含以下内容:
from ..folder2 import helper
helper.h1()
而助手py有以下功能:
def h1():
print("Hello")
当我跑的时候 python文件将导入py,它给出的错误是:
Traceback (most recent call last):
File "file_will_import.py", line 1, in <module>
from ..folder2 import helper
ValueError: attempted relative import beyond top-level package.
我试过谷歌的所有东西,但都没用。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐