为什么 VS Code 的 Pylance 不显示 opencv 的函数描述?

问题描述 投票:0回答:1

我刚刚安装了 MS VS Code 并安装了所有推荐的 Python 扩展,包括 Pylance。在我看到的每个 opencv 教程中,当我键入它们或将鼠标悬停在它们上方时,都会显示每个函数的描述。

但是正如您在下图中看到的,我没有得到任何描述。

我得到的信息:

我想得到的信息:

在 settings.json 中,我已经将

languageServer
设置为 Pylance。

我还尝试卸载所有扩展并重新安装 VSCode。

python opencv visual-studio-code intellisense pylance
1个回答
0
投票

您的图片显示了

imread
的描述。至于为什么和你的教程不一样,我想这很可能和opencv版本有关。您可以查看您的教程发布时间并安装同期或相近时期的opencv版本。

pip install packageName==versionNumber

https://pypi.org/project/opencv-python/#history

关于智能感知:

https://code.visualstudio.com/docs/python/editing#_autocomplete-and-intellisense https://code.visualstudio.com/docs/editor/intellisense#_intellisense-features https://typing.readthedocs.io/en/latest/source/stubs.html

© www.soinside.com 2019 - 2024. All rights reserved.