Jupyter笔记本:未检测到小部件Javascript [英] Jupyter notebook: Widget Javascript not detected
问题描述
问题:
我在MacOs 10.9中使用pip3安装了python3和jupyter笔记本.
当我尝试运行窗口小部件时,它提示没有javascript窗口小部件.
我在Jupyter-notebook中安装了python3和R内核.
Question:
I installed python3 and jupyter notebook using pip3 in MacOs 10.9.
When I try to run the widget it gives error that there is no javascript widget.
I have python3 and R kernels installed in Jupyter-notebook.
代码:
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.
最后一条命令给出了错误.
The last command gives error.
[EnableNBExtensionApp] CRITICAL | Bad config encountered during initialization:
[EnableNBExtensionApp] CRITICAL | Unrecognized flag: '--py'
请注意,在Mac中,我有jupyter-nbextension命令,但是命令:
Note that in mac I have jupyter-nbextension command but the command:
jupyter-nbextension enable --py widgetsnbextension
也不起作用.
但是jupyter nbextension enable widgetsnbextension
没有给出错误,也没有执行任何操作.如果我运行代码,则会弹出相同的错误.
But jupyter nbextension enable widgetsnbextension
gives no error and also does nothing. The same error is popped in if I run the code.
还
import ipywidgets
ipywidgets.__version__
给出"6.0.0".
gives '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吗?
How can I install widgets?
Do I need to install java separately ?
推荐答案
运行以下命令:
jupyter nbextension enable --py --sys-prefix widgetsnbextension
,然后在Jupyter中重新启动内核即可解决问题.
Run the following command:
jupyter nbextension enable --py --sys-prefix widgetsnbextension
, then restart the kernel in Jupyter should do the trick.
这篇关于Jupyter笔记本:未检测到小部件Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!