运行 IPyhon.widgets 时没有名为 'ipywidgets' 的模块错误
No module named 'ipywidgets' error when running IPyhon.widgets
我安装了 IPython 4.0.1。我无法找出以下错误的原因 -
>>> from IPython.html import widgets
>>> k = widgets.Box
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\IPython\utils\shimmodule.py", line 90, in __getattr__
return import_item(name)
File "C:\Python34\lib\site-packages\IPython\utils\importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
ImportError: No module named 'ipywidgets'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
k = widgets.Box
File "C:\Python34\lib\site-packages\IPython\utils\shimmodule.py", line 92, in __getattr__
raise AttributeError(key)
AttributeError: Box
我该如何解决这个问题?
ipywidgets 未与 IPython 一起安装。安装即可。
pip install ipywidgets
在 IPython 3 和 IPython 4 之间,许多组件被拆分成单独的包 (http://blog.jupyter.org/2015/04/15/the-big-split/)。小部件是受影响的功能之一。
您可以通过标准渠道安装 ipywidgets(正如 Yashu Seth 所建议的):
pip install ipywidgets
# or
conda install ipywidgets
并且您应该养成不从 IPython.html 导入小部件的习惯,因为旧的库结构已被弃用。
我安装了 IPython 4.0.1。我无法找出以下错误的原因 -
>>> from IPython.html import widgets
>>> k = widgets.Box
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\IPython\utils\shimmodule.py", line 90, in __getattr__
return import_item(name)
File "C:\Python34\lib\site-packages\IPython\utils\importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
ImportError: No module named 'ipywidgets'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
k = widgets.Box
File "C:\Python34\lib\site-packages\IPython\utils\shimmodule.py", line 92, in __getattr__
raise AttributeError(key)
AttributeError: Box
我该如何解决这个问题?
ipywidgets 未与 IPython 一起安装。安装即可。
pip install ipywidgets
在 IPython 3 和 IPython 4 之间,许多组件被拆分成单独的包 (http://blog.jupyter.org/2015/04/15/the-big-split/)。小部件是受影响的功能之一。
您可以通过标准渠道安装 ipywidgets(正如 Yashu Seth 所建议的):
pip install ipywidgets
# or
conda install ipywidgets
并且您应该养成不从 IPython.html 导入小部件的习惯,因为旧的库结构已被弃用。