【问题标题】:jupyter notebooks: How to enable widget javascript?jupyter notebooks:如何启用小部件 javascript?
【发布时间】:2017-10-25 06:17:55
【问题描述】:

我正在尝试在 virtualenv 中运行 jupyter notebook。但是当启动它并创建一个简单的ipywidgets 示例时,我收到以下错误:

Widget Javascript not detected.  It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"

示例代码在这里:

from ipywidgets import Button, HBox
from ipywidgets import *

button = Button()
button.description = "Test"
display(button)

我在终端上运行了以下命令:

jupyter nbextension enable --py widgetsnbextension
jupyter nbextension enable --py --sys-prefix widgetsnbextension

我重新启动了笔记本,也看到了类似的问题herehere,但我仍然得到同样的错误。

  • python 2.7.12
  • ipywidgets 5.2.2
  • 火狐56.0
  • ubuntu 16.04.3

我需要保留ipywidgets 版本以便进行测试。

【问题讨论】:

    标签: javascript python jupyter-notebook


    【解决方案1】:

    我找到了解决办法:

    确保从系统配置中删除任何可能与 jupyternotebookipywidgets 相关的任何内容,然后在您的 virtualenv 中重新安装所有内容。然后运行这个enable 命令,启动笔记本,它应该可以工作了......

    【讨论】:

      【解决方案2】:
      sudo pip install ipywidgets --upgrade
      

      帮了我

      【讨论】:

      • 虽然此代码可能会回答问题,但提供有关它如何和/或为什么解决问题的额外上下文将提高​​答案的长期价值。您可以在帮助中心找到更多关于如何写好答案的信息:stackoverflow.com/help/how-to-answer。祝你好运?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-24
      • 1970-01-01
      • 2019-12-04
      • 2020-03-12
      • 1970-01-01
      • 2019-04-11
      • 2014-12-19
      相关资源
      最近更新 更多