問題: 我在MacOs 10.9中安裝了python3和jupyter筆記本,使用pip3。
當我嘗試運行這個小部件時,它給出了沒有javascript小部件的錯誤。 我在Jupyter筆記本中安裝了python3和R內核。Jupyter notebook:Widget Javascript未檢測到
代碼:
from ipywidgets import widgets
from IPython.display import display
text = widgets.Text()
display(text)
text.on_submit('hello')
錯誤:
Widget Javascript not detected. It may not be installed or enabled properly.
嘗試:
sudo -H pip3 install ipywidgets
sudo -H pip3 install -upgrade ipywidgets
jupyter nbextension enable --py widgetsnbextension
# restarted the computer.
的最後一個命令給出了錯誤。
[EnableNBExtensionApp] CRITICAL | Bad config encountered during initialization:
[EnableNBExtensionApp] CRITICAL | Unrecognized flag: '--py'
注意,在MAC我有jupyter-nbextension命令,但命令:
jupyter-nbextension enable --py widgetsnbextension
也不起作用。
但jupyter nbextension enable widgetsnbextension
不給出錯誤,也不做任何事情。如果我運行代碼,則彈出相同的錯誤。
此外,
import ipywidgets
ipywidgets.__version__
給 '6.0.0'。
一些注意事項:
which jupyter
jupyter is /Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter
which jupyter-notebook
jupyter-notebook is /Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter-notebook
相關鏈接:
https://github.com/jupyter-widgets/ipywidgets/issues/541
https://github.com/jupyter/help/issues/32
https://github.com/jupyter/help/issues/131
https://github.com/binder-project/binder/issues/83
如何安裝小工具?
我是否需要單獨安裝java?
在這裏找到答案(壞消息 - ipywidgets不PyCharm支持): https://stackoverflow.com/questions/41106767/pycharm-notebook- widget-javascript-not-detected –