无法从 Spyder 中的 IPython.html.widgets 导入小部件

Mad*_*ddy 0 python ipython spyder ipywidgets

我正在使用spyder 来运行我的代码。

from Ipython.html.widgets import interact, ButtonWidget
Run Code Online (Sandbox Code Playgroud)

我尝试将 Ipython.html.widgets 替换为 ipywidgets 并执行它。它让我回想起:

from ipywidgets import interact, ButtonWidget

ImportError: cannot import name ButtonWidget"
Run Code Online (Sandbox Code Playgroud)

Car*_*oba 5

你说

我正在使用spyder 来运行我的代码。

但是,IPython Widgets 代码无法在 Spyder 中运行,因为它的控制台无法显示 Html 内容。

因此,您需要在 Jupyter Notebook 中运行此代码。