在执行ctrl+在VS代码(Python)中单击(转到定义)时,如何查看库中的源代码
我知道在VS代码中,我们可以通过CTRL +单击找到变量/函数的定义。 Ctrl + Click还支持我们安装的库中声明的变量/功能(例如Torch,Numpy,..)。
在我的VS代码中,可以使用自己的文件中的“转到定义”,但我无法单击库中定义的变量。
我想要库的变量/功能,也可以通过CTRL+单击搜索。我如何也可用?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您在虚拟环境中安装库,则应将python解释器更改为
virtualenv
您从VSCODE的右侧使用,然后Alt+Alt+单击
可以帮助您你。If you install the libraries in your virtual environments, You should change the python interpreter to your
virtualenv
that you use from bottom right side of the vscode and thenalt+click
can help you.这是塔提供的功能。
您可以安装 pylance> pylance 扩展。
This is a function provided by pylance.
You can install pylance extension.
就我而言,我必须选择已安装库的正确环境。
只需打开命令调色板( ctrl + p 或 ⌘+ p p 取决于您的操作系统),然后Enter python:选择解释器:
In my case I had to select the correct environment which had the libraries installed.
Simply open the command palette (CTRL+P or ⌘+P depending on your OS), then enter
Python: Select Interpreter
: