jupyter notebook安装插件,代码自动补全
参考这两篇博客
https://blog.csdn.net/weixin_37595559/article/details/81540482,
https://blog.csdn.net/qq_37087781/article/details/85110040。
- 首先安装nbextensions,在命令行环境中输入
pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple
jupyter contrib nbextension install --user
- 安装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-nbextensions
和jupyter-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就可以了,这下就可以自动补全了,一下子方便了许多。