如何获取并安装JupyterLab扩展的最新版本?旧更新命令已弃用
解决JupyterLab扩展过时无法更新的问题
问题背景
运行jupyter labextension list显示多个扩展过时:
[automata] ~/Documents/Projects/Coding/Python/automata (master *=) $ jupyter labextension list JupyterLab v4.0.1 /Users/Rax/Documents/Projects/Coding/Python/venvs/automata/share/jupyter/labextensions jupyterlab_pygments v0.2.2 enabled X (python, jupyterlab_pygments) nbdime-jupyterlab v2.2.0 enabled X jupyter-matplotlib v0.11.3 enabled OK @jupyterlab/git v0.41.0 enabled X (python, jupyterlab-git) @jupyter-widgets/jupyterlab-manager v5.0.7 enabled X (python, jupyterlab_widgets) The following extensions are outdated: jupyterlab_pygments nbdime-jupyterlab @jupyterlab/git @jupyter-widgets/jupyterlab-manager Consider running "jupyter labextension update --all" to check for updates.
但执行jupyter labextension update --all时提示命令已弃用:
(Deprecated) Updating extensions with the jupyter labextension update command is now deprecated and will be removed in a future major version of JupyterLab. Users should manage prebuilt extensions with package managers like pip and conda, and extension authors are encouraged to distribute their extensions as prebuilt packages
解决方法
JupyterLab 4.0+已弃用jupyter labextension命令管理扩展,需通过pip(你当前使用虚拟环境)更新对应Python包:
- 先激活你的虚拟环境
automata - 执行以下命令逐个更新扩展对应的包:
- 更新jupyterlab_pygments:
pip install --upgrade jupyterlab_pygments - 更新nbdime-jupyterlab(对应包为nbdime):
pip install --upgrade nbdime - 更新@jupyterlab/git(对应包为jupyterlab-git):
pip install --upgrade jupyterlab-git - 更新@jupyter-widgets/jupyterlab-manager(对应包为jupyterlab_widgets):
pip install --upgrade jupyterlab_widgets
- 更新jupyterlab_pygments:
- 更新完成后,重启JupyterLab,再运行
jupyter labextension list确认扩展版本已更新。
内容的提问来源于stack exchange,提问作者orome
相关产品推荐
相关产品推荐

