欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

jupyter notebook安装插件,代码自动补全

程序员文章站 2022-05-25 13:01:53
...

  1. 首先安装nbextensions,在命令行环境中输入
pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple
jupyter contrib nbextension install --user
  1. 安装nbextensions_configurator,在命令行环境中输入
pip install --user jupyter_nbextensions_configurator 
jupyter nbextensions_configurator enable --user

但是在安装完成之后,重新运行jupiter notebook,并没有出现nbextension插件,报错显示:

[W 21:01:51.399 NotebookApp] 加载插件 jupyter_nbextensions_configurator 失败
   Traceback (most recent call last):
     File "/home/vc/.local/lib/python3.5/site-packages/notebook/notebookapp.py", line 1572, in init_server_extensions
       mod = importlib.import_module(modulename)
     File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
       return _bootstrap._gcd_import(name[level:], package, level)
     File "<frozen importlib._bootstrap>", line 986, in _gcd_import
     File "<frozen importlib._bootstrap>", line 969, in _find_and_load
     File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
   ImportError: No module named 'jupyter_nbextensions_configurator'

使用命令pip list确实已经安装了jupyter-contrib-nbextensionsjupyter-nbextensions-configurator,根据博客 https://blog.csdn.net/Fire_to_cheat_/article/details/84938975 所述,输入命令:

python -m pip install --user jupyter_contrib_nbextensions

重启jupyter notebook,还是没有显示,由于我的笔记本同时装了python2.7和python3.5,所以应该针对python3.5也执行命令:

python3.5 -m pip install --user jupyter_contrib_nbextensions

重新运行jupyter notebook就可以了,这下就可以自动补全了,一下子方便了许多。