小编Jon*_*nas的帖子

Ipywidgets 未显示并出现 JavaScript 错误

目前,我们的团队正在使用 JupyterHub。当我尝试在 JupyterLab 中使用 ipywidgets 时,出现此 JavaScript 错误(https 地址被删除)

\n

代码

\n
import ipywidgets as widgets\n\nslider = widgets.FloatSlider(description=\'$x$\')\ntext = widgets.FloatText(disabled=True, description=\'$x^2$\')\n\ndef compute(*ignore):\n    text.value = str(slider.value ** 2)\n\nslider.observe(compute, \'value\')\n\nslider.value = 4\n\nwidgets.VBox([slider, text])\n
Run Code Online (Sandbox Code Playgroud)\n

笔记本上的错误:

\n
[Open Browser Console for more detailed log - Double click to close this message]\nFailed to load model class \'VBoxModel\' from module \'@jupyter-widgets/controls\'\nError: Module @jupyter-widgets/controls, version ^1.5.0 is not registered, however,         2.0.0 is\n    at f.loadClass (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.bcbea9feb6e7c4da7530.js?v=bcbea9feb6e7c4da7530:1:74977)\n    at f.loadModelClass (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1:10729)\n    at f._make_model (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1:7517)\n    at f.new_model (/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.3e1e5adfd821b9b96340.js?v=3e1e5adfd821b9b96340:1:5137)\n    at f.handle_comm_open …
Run Code Online (Sandbox Code Playgroud)

jupyter-notebook jupyterhub ipywidgets jupyter-lab

11
推荐指数
1
解决办法
1552
查看次数