jupyter notebook 默认的代码补全使用 jedi,需要每次敲 tab键,才能调起代码补全,非常不方便,所以,接下来的步骤,需要禁掉jedi,启用hinterland做代码补全。
我电脑上的版本: jupyter -version
jupyter core : 4.7.1
jupyter-notebook : 6.4.0
ipython : 7.26.0
ipykernel : 6.0.3
jupyter client : 6.1.12
jupyter lab : 3.1.1
启动代码补全步骤:
1)禁掉 jedi
ipython profile creat
vi ~/.ipython/profile_default/ipython_config.py
c.Completer.use_jedi = False //把这行注释打开,把True改成False
2)安装 nbextension
pip install jupyter_contrib_nbextensions --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple
jupyter contrib nbextension install --user
3)启动jupyther notebook
jupyter notebook
4)按照如图所示,勾选hinterland即可
注意:以上步骤只适用于 jupyter notebook, 不适用 jupyter lab,我的电脑上,目前jupyter lab代码补全仍然没有。
jupyter notebook 启用后的代码补全是这样(不需要敲tab键触发)