交互式 Jupyter 小部件在 Jupyter 实验室中不起作用

cls*_*udt 9 python jupyter jupyter-notebook jupyter-lab

我注意到交互式小部件在我的 Jupyter Lab 笔记本中不起作用。

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

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

def f(x):
    return x

interact(f, x=10);
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

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

小智 5

您需要安装小部件扩展

pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension --sys-prefix
Run Code Online (Sandbox Code Playgroud)

  • 这不是修复它。 (2认同)