在VSCod中引入标准模块

2024-04-24 16:42:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用Visual Studio代码编写了以下简单代码:

import copy

a = 3
b = copy.copy(a)

print(b)

想看看复制.py调试时。你知道吗

visualstudio代码可以这样吗?如果是,怎么做?你知道吗

我在“import copy”和复制.py(位于C:\Users\\AppData\Local\Programs\Python\Python37-32\Lib)\复制.py). 你知道吗


Tags: 代码pyimportliblocalusersappdataprint
1条回答
网友
1楼 · 发布于 2024-04-24 16:42:53

Vscode在调试时默认忽略标准库。你知道吗

将以下内容添加到launch.json中首选的Python调试器配置中:

"debugStdLib": true

我的样子是这样的:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Python: Current File (Integrated Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "debugStdLib": true
        },
    ]
}

资料来源:https://github.com/Microsoft/vscode-python/issues/2039#issuecomment-404925035

相关问题 更多 >