进入VSCode中导入的标准模块

红狼

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

import copy

a = 3
b = copy.copy(a)

print(b)

目的是在调试时查看copy.py的内部作品。

使用Visual Studio Code可以做到吗?如果是这样,怎么办?

我在“导入副本”和copy.py的第一行上放置了一个断点(位于C:\ Users \\ AppData \ Local \ Programs \ Python \ Python37-32 \ Lib \ copy.py)。

lucasgcb

调试时,Vscode默认情况下会忽略标准库。

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

"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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章