简体   繁体   中英

Cannot import widget from IPython.html.widgets in Jupyter notebook

I am using Jupyter to run my code.

from Ipython.html.widgets import interact, ButtonWidget
from IPython.display import display, clear_output

I am not getting the following error for that:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-6-3fa9b991f293> in <module>()
----> 1 from IPython.html.widgets import interact, ButtonWidget
  2 from IPython.display import display, clear_output

ModuleNotFoundError: No module named 'widgets'

I tried to replace IPython.html.widgets to ipywidgets and execute it. It threw me back:

from ipywidgets import interact, ButtonWidget

ImportError: cannot import name ButtonWidget"

这些对象进行了一些重命名:

from ipywidgets import interact, Button

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM