我应该如何组织我的Python导入,以便我可以拥有像这样的目录。
project
| \
| __init__.py
|
src
| \
| __init__.py
| classes.py
|
test
\
__init__.py
tests.py
然后在 /project/test/tests.py 中,需要导入 classes.py 文件。
我在 tests.py 文件中有如下代码:
from .. src.classes import(
scheduler
db
)
我遇到了以下错误:
SystemError: Parent module '' not loaded, cannot perform relative import
有人知道该怎么做吗?
test/
目录下有一个__init__.py
文件。 - Translunar