1
我一直在寻找stackoverflow并找不到错在哪里。从兄弟目录中导入py给出了非包错误中的尝试相对导入
我的目录结构如下:
--project
--__init__.py
--helpers
--__init__.py
--functions.py
--set1
--__init__.py
--foo.py
--set2
--__init__.py
--setn
--__init__.py
在foo.py
我想导入functions.py
我这样做与
from ..helpers import functions
,这是给我的错误:
Attempted relative import in non-package error
我到目前为止发现的所有答案de al设置init .py正确。
在Mac
可能的重复http://stackoverflow.com/questions/11536764/how-to-fix-attempted-relative-import-in-non-package-even-with-init-py – YellowShark