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

  • Post author:
  • Post category:其他




动机

众所周知,Jupyer notebook 体量小,特别适合初学者的代码调试。其每一个Cell都可以将历史的变量保存起来。但是其相对 pycharm 美中不足的就是没有自带“代码补全”的功能,幸好的是有扩展来完善。

买了新的电脑,我也想要按照旧电脑的安装方式安装该扩展—jupyter_contrib_nbextension,但是按照旧的教程安装不上了,然后找解决方案,尝试了好几个无用的帖子,感觉心累,误导人,最后找到了解决方案,用作笔记。

其实该帖子的解决方案不是我解决的,因此要感谢博主“duqiumail”关于《Jupyter notebook安装扩展工具(nbextensions)提示“Jupyter command

jupyter-contrib

not found.”》帖子,链接在尾部有原始链接。


本人使用的python版本为 Anaconda3-2019.10,python37



旧的安装插件的教程(可以跳过)

windows + R,输入

cmd

进入命令行界面

pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple
jupyter contrib nbextension install --user 
#  这里旧报错了,Jupyter command `jupyter-contrib` not found,但是旧电脑上没有报该错。
pip install --user jupyter_nbextensions_configurator 
jupyter nbextensions_configurator enable --user

然后进入jupyter notebook 后,发现菜单狼多出来了

Nbextensions

选项,然后勾选

Hinterland

勾选上.大功告成。

但是在

jupyter contrib nbextension install --user

的地方旧报错了。



Jupyter command

jupyter-contrib

not found. 解决方案——新的安装方式。

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

2.2 然后 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

2.3 在该目录下,cmd 执行下面命令手动安装

python application.py install

2.4 然后安装

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在工具栏了

在这里插入图片描述


版权声明:本文的为《Jupyter command

jupyter-contrib

not found. 解决方案——新的安装方式》处为CSDN博主「duqiumail」的原创文章。

原文链接:https://blog.csdn.net/duqiumail/article/details/107650058



版权声明:本文为VictoriaLy原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。