Jupyter Notebook添加代码自动提示和补全功能

简介:Jupyter Notebook没有代码自动提示和补全功能。该教程将展示如何实现代码自动补全和提示的功能。

1. Conda

conda-forge 提供了用于笔记本扩展和 jupyter_nbextensions_configurator 的 conda 包。 您可以使用以下方式安装两者

conda install -c conda-forge jupyter_contrib_nbextensions

这也会自动安装 Javascript 和 CSS 文件 (使用 ),因此 可以跳过下面的第二个安装步骤。jupyter contrib nbextension install --sys-prefix

官网:https://github.com/ipython-contrib/jupyter_contrib_nbextensions

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Jupyter Lab 提供了自动补全代码功能,可以大大提高编程效率。以下是实现自动补全代码的步骤: 1. 安装 Jupyter Lab 插件:jupyterlab-lsp 和 jupyterlab-lsp-python。可以使用以下命令进行安装: ``` pip install jupyterlab-lsp jupyterlab-lsp-python ``` 2. 启动 Jupyter Lab,打开一个 Python Notebook。 3. 打开左侧边栏的 Settings,选择 Advanced Settings Editor。 4. 在 Advanced Settings Editor 中,选择 Notebook 右侧的 Python。 5. 在 Python 设置中,找到 "Editor Config" 一项,点击 "Add Item"。 6. 在 "Editor Config" 中添加以下代码: ``` { "autoClosingBrackets": true, "autoClosingQuotes": true, "autoComplete": true, "autoPairBrackets": true, "codeSnippets": true, "cursorBlinkRate": 530, "cursorSmoothCaretAnimation": true, "cursorWidth": 1, "displayIndentGuides": true, "dragAndDrop": true, "editorFontSize": 14, "editorFontWeight": "bold", "editorIndentSize": 4, "editorLineHeight": 1.5, "editorMatchBrackets": true, "editorTabSize": 4, "fontFamily": "monospace", "fontStyle": "italic", "fontWeight": "bold", "highlightActiveIndentGuide": true, "lineNumbers": true, "lineWrap": "off", "matchBrackets": true, "minimapEnabled": true, "mouseWheelZoom": true, "multiCursorModifier": "alt", "renderWhitespace": "none", "scrollBeyondLastColumn": 5, "scrollbar": { "alwaysConsumeMouseWheel": true, "useShadows": true }, "scrollbarStyle": "native", "wordWrap": "off" } ``` 7. 保存设置并重新加载页面。 现在,当你输入代码时,Jupyter Lab 会自动提示可能的代码完成项。你可以使用 Tab 键来选择代码完成项。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值