简体   繁体   English

VSCode Intellisense 在编辑 python 文件时有效,但在 Jupyter Notebook 中无效

[英]VSCode Intellisense works when editing a python file but does not work in Jupyter Notebook

I'm using VSCode on a Windows 10 OS.我在 Windows 10 操作系统上使用 VSCode。 The Intellisense feature works fine when I'm editing a Python file (eg when I type 'imp' the editor recommends 'import'), but not when editing a Jupyter notebook within the same VSCode session. Intellisense 功能在我编辑 Python 文件时工作正常(例如,当我键入“imp”时,编辑器建议“导入”),但在同一 VSCode session 中编辑 Jupyter notebook 时则不然。

I have tried starting a fresh session, and switching to multiple different interpreters, but the above scenario keeps happening.我已经尝试启动一个新的 session,并切换到多个不同的解释器,但上述情况不断发生。 VSCode's website states that Jupyter Notebook editors have full IntelliSense support. VSCode 的网站声明 Jupyter Notebook 编辑器具有完整的 IntelliSense 支持。

UPDATE更新

I disabled and uninstalled a language support extension called Pylance and now the Intellisense works on some notebook kernels (eg it works in a Python 3.8.0 kernel but not a Python 3.6.5 kernel).我禁用并卸载了一个名为 Pylance 的语言支持扩展,现在 Intellisense 在一些笔记本内核上工作(例如,它在 Python 3.8.0 kernel 但不是 Python 3.6.5 内核中工作)。 Still works just fine in regular *.py files.在常规 *.py 文件中仍然可以正常工作。

When I use the " Microsoft " language service, Jupyter in VS Code has "Intellisense":当我使用“ Microsoft ”语言服务时,VS Code 中的 Jupyter 具有“Intellisense”:

在此处输入图像描述

When I use the " Pylance " language service, Jupyter in VS Code has "Intellisense":当我使用“ Pylance ”语言服务时,VS Code 中的 Jupyter 具有“Intellisense”:

在此处输入图像描述

As for "Intellisense" in VSCode's website, this problem is currently being fixed.至于VSCode官网的“Intellisense”,目前正在修复这个问题。 Github link: IntelliSense is not working in Jupyter Notebook editor . Github 链接: IntelliSense is not working in Jupyter Notebook editor

Here is a workaround and you could refer to it:这是一个解决方法,您可以参考它:

It is recommended that you use " Visual Studio Code Insiders ", which has rich "Intellisense" in Jupyter:推荐大家使用“ Visual Studio Code Insiders ”,它在Jupyter中有丰富的“Intellisense”:

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么 matplotlib.pyplot 在使用 jupyter notebook 时工作正常,但从 CMD 中的 a.py 文件运行时却不起作用? - why does matplotlib.pyplot works fine when using jupyter notebook but it does not work when running from a .py file in CMD? Tensorflow 2 适用于 Jupyter Notebook 但不适用于 VsCode - Tensorflow 2 works on Jupyter Notebook but not on VsCode 使用 VSCode 时找不到 sklearn 模块,但在 Jupyter Notebook 中工作正常? - sklearn module not found when using VSCode, but works fine in Jupyter Notebook? Jupyter Notebook中的Python多处理不起作用 - Python Multiprocessing within Jupyter Notebook does not work VSCode 中的 Python/Jupyter 笔记本没有使用正确的环境 - Python/Jupyter notebook in VSCode does not use the right environment 为什么 vscode 上的 jupyter notebook 总是说没有安装 Python? - Why does jupyter notebook on vscode always say not Python is installed? VScode:使用任务自动将python文件转换为Jupyter笔记本 - VScode: Automating conversion of python file to Jupyter notebook with a task 在 vscode 中的非笔记本 python 文件中创建 jupyter 单元的快捷方式 - Shortcut to creating a jupyter cell in a non-notebook python file in vscode import graphviz 在 jupyter notebook 中有效,但相同的代码在 Pycharm 中无效 - import graphviz works in jupyter notebook, but the same code does not work in Pycharm Vscode 自动完成功能不适用于 Jupyter Notebook - Vscode autocompletion doesn't work for Jupyter Notebook
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM