【问题标题】:Interactive Jupyter Widgets not working in Jupyter Lab交互式 Jupyter 小部件在 Jupyter Lab 中不起作用
【发布时间】:2019-03-06 12:21:32
【问题描述】:

我注意到 interactive widgets 在我的 Jupyter Lab 笔记本中不起作用。

以下代码应生成交互式滑块,但不会:

from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets

def f(x):
    return x

interact(f, x=10);

这里有什么问题,我怎样才能让小部件工作?

【问题讨论】:

标签: python jupyter-notebook jupyter jupyter-lab


【解决方案1】:

根据docs

要安装 JupyterLab 扩展,您还需要在终端中运行以下命令这需要您安装 nodejs

jupyter labextension install @jupyter-widgets/jupyterlab-manager

我认为您缺少的是后一个 nodejs 要求,例如使用 Conda,第一次运行:

conda install nodejs

【讨论】:

  • 对我不起作用 - 错误:在注册表中找不到对象“jupyter.widget”
【解决方案2】:

您需要安装小部件扩展

pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension --sys-prefix

【讨论】:

  • !> jupyter nbextension enable --py widgetsnbextension --sys-prefix 117ms < Tue Oct 2 12:26:48 2018 Error executing Jupyter command 'nbextension': [Errno 2] No such file or directory
  • 这不是修复它。
猜你喜欢
  • 2021-08-01
  • 2020-03-20
  • 2017-01-13
  • 2019-04-30
  • 1970-01-01
  • 2021-01-18
  • 1970-01-01
  • 2022-10-06
  • 2017-11-03
相关资源
最近更新 更多