2015-12-18 56 views
1

我安裝了IPython 4.0.1。我無法弄清以下錯誤的原因 -運行IPyhon.widgets時沒有名爲'ipywidgets'錯誤的模塊

>>> 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 

我該如何解決這個問題?

+0

'pip install ipywidgets' – cel

+0

oops。謝謝。嚴重的這並沒有跨越我的腦海:-) –

回答

4

IPython的3和IPython的4之間,多個部件被分成單獨的包(http://blog.jupyter.org/2015/04/15/the-big-split/)。小工具是受影響的功能之一。

您可以通過標準的渠道來安裝ipywidgets(如衙署賽斯建議):

pip install ipywidgets 
# or 
conda install ipywidgets 

你應該在不IPython.html進口部件的習慣得到的,因爲舊庫的結構已被棄用。

0

ipywidgets未安裝IPython。只需安裝它。

pip install ipywidgets 
相關問題