【发布时间】:2020-08-28 17:37:38
【问题描述】:
我的项目主管中有带有该结构的子模块
submodule/
__init__.py
nested/
__init__.py
aa.py
submodule/ 中的__init__.py 包含以下代码
import sys, os
sys.path.append(os.path.abspath(".."))
import aa
而submodule/nested 中的__init__.py 包含以下代码
from .aa import *
所以如果我在带有submodule 的目录中,我可以执行以下操作,一切都会好起来的
import submodules.aa
但它在 google colab 上失败了,我想这很可能是因为这条线没有做应有的功能
sys.path.append(os.path.abspath(".."))
我正在尝试从我想在 google colab 上运行的 jupyter notebook 进行上述导入
【问题讨论】:
标签: python python-3.x jupyter-notebook google-colaboratory