jupyter notebook代码补全扩展安装遇到 Jupyter command `jupyter-contrib` not found.” 问题

发布时间 2023-12-06 17:50:28作者: ashuai~

Jupyter command jupyter-contrib not found. 解决方案——新的安装方式。

方法1 : pip方式

1.先使用以下命令,卸载旧版本的 jupyter_contrib_nbextensions 和 upyter_nbextensions_configurator:
分别用cmd命令,卸载之前的安装

pip uninstall jupyter_contrib_nbextensions
pip uninstall jupyter_nbextensions_configurator

2.重新下载并安装:
2.1 先cmd命令安装

pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com jupyter_contrib_nbextensions

然后 cmd 进入 ~Lib\site-packages\jupyter_contrib_nbextensions 目录
例如C:\ProgramData\Anaconda3\Lib\site-packages\jupyter_contrib_nbextensions

有时候会在用户文件夹下,如C:\Users\he\Python\Python38\Lib\site-packages\jupyter_contrib_nbextensions

在该目录下,cmd 执行下面命令手动安装python application.py install

 然后安装

jupyter contrib-nbextension install --user

这时就不会提示“Jupyter command jupyter-contrib not found.”这个问题了

3 接下来继续安装

pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user

这时从新启动jupyter notebook 就成功看到工具Nbextensions在工具栏了

方法2: conda方式

解决方法
删除原先安装的 jupyter_contrib_nbextension 包,指令为:
pip uninstall jupyter_contrib_nbextensions
pip uninstall jupyter_nbextensions_configurator #如果也有安装这个包

根据官方文档提示,可以使用以下两条指令替代
conda install -c conda-forge jupyter_contrib_nbextensions
jupyter contrib nbextension install --sys-prefix

安装 jupyter_nbextensions_configurator 包,指令为:
conda install -c conda-forge jupyter_nbextensions_configurator