ModuleNotFoundError:没有名为' utils'从子包中间接导入时

时间:2018-05-15 20:32:19

标签: python python-3.x import python-import

我有以下文件夹结构:

enter image description here

进一步向下,与" account_test.py"相同的包裹我使用以下命令在account_test.py中导入utils.py:

from utils import account_tester

我直接调用account_test时工作正常。但是,当我尝试使用以下命令将account_test导入new_account_test.py时:

from .. import account_test

我收到以下错误:

ModuleNotFoundError: No module named 'utils'

我知道有几个类似的问题,但我还没有找到完全匹配的东西,它必须与我使用相对路径导入相关,但无法找出正确的语法。

0 个答案:

没有答案