【发布时间】:2020-10-07 07:47:57
【问题描述】:
我在 .ipynb 文件所在的同一目录中编写了名为 CombinedAttributesAdder 的简单类。喜欢:
-project
-project.ipynb
-combined_attributes_adder.py
此文件包含名为 CombinedAttributesAdder 的类 当我尝试将此类导入 ipynb 时,例如:
from combined_attributes_adder import CombinedAttributesAdder
它给了我一个错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-73-65ed70439bcc> in <module>
----> 1 from combined_attributes_adder import CombinedAttributesAdder
ImportError: cannot import name 'CombinedAttributesAdder' from 'combined_attributes_adder' (/home/mat/Documents/Projects/machine-learning-notebooks/projects/combined_attributes_adder.py)
这是为什么呢?
【问题讨论】:
标签: python-3.x jupyter-notebook python-module