python - Jupyter笔记本电脑: Widget Javascript not detected

标签 python jupyter-notebook ipywidgets

问题:
我在MacOs 10.9中使用pip3安装了python3和jupyter笔记本。
当我尝试运行窗口小部件时,它提示没有javascript窗口小部件。
我在Jupyter-notebook中安装了python3和R内核。

代码:

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

最佳答案

运行以下命令:jupyter nbextension enable --py --sys-prefix widgetsnbextension,然后在Jupyter中重新启动内核应该可以解决问题。

关于python - Jupyter笔记本电脑: Widget Javascript not detected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43769068/

相关文章:

python - 黑盒功能的交互/交互

python - 计算等高线的周长(OpenCV、Python)

python - 使用带有 Python BeautifulSoup 的 LazyLoader 抓取页面

python-3.x - 无法在jupyter中导入python包

shell - 使 Jupyter 笔记本中的 shell 命令的输出静音

python - 使用 os.walk 在 python 中仅列出所有带有 png 的子目录

python - 如何在 Jupyter 选项卡小部件中显示 matplotlib 图?

python - 将 pandas 多索引 DataFrame 的列替换为另一个 DataFrame

python - 日期时间格式并添加日期时间

Python - matplotlib - subplot() 和 subplots() 之间的区别