jupyter notebook 实现写代码自动补全功能

这篇文章将为大家详细讲解有关jupyter notebook 实现写代码自动补全功能,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

操作步骤

进入命令行环境。我使用的是conda。有两种方式进入命令行。

方法1:通过anconda navigator界面,选择environments,选择对应环境名,选择open terminal

方法2:直接使用cmd或者terminal等终端进入命令行。激活你想要配置代码补全的环境(如果是默认环境不用激活)

1.安装nbextensions 

pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple
jupyter contrib nbextension install --user

2.安装nbextensions_configurator

pip install --user jupyter_nbextensions_configurator 
jupyter nbextensions_configurator enable --user

如果提示缺少依赖,就使用pip安装对应依赖即可。

重启jupyter,在弹出的主页面里,能看到增加了一个Nbextensions标签页,在这个页面里,勾选Hinterland即启用了代码自动补全,打开一个notebook感受一下吧。

jupyter notebook 实现写代码自动补全功能 

jupyter notebook 实现写代码自动补全功能 

jupyter notebook 实现写代码自动补全功能 

如果出现错误如下:

Installing collected packages: msgpack
Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。:
'E:\\JiangHeSong\\Anaconda35.2.0\\Lib\\site-packages\\msgpack\\_packer.cp36-win_
amd64.pyd'
Consider using the `--user` option or check the permissions.

You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

只需要加一个--user 例如:

pip install --user msgpack -i https://pypi.mirrors.ustc.edu.cn/simple

关于jupyter notebook 实现写代码自动补全功能就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。