选择Python环境。 步骤2:修改launch.json launch.json文件的内容可能类似于如下示例: AI检测代码解析 {"version":"0.2.0","configurations":[{"name":"Python: Current File","type":"python","request":"launch","script":"${file}","console":"integratedTerminal","cwd":"${workspaceFolder}"// 这里是...
: "${fileDirname}","program": "${file}","console": "integratedTerminal","justMyCode": true } ]}在这个示例中,为Python语言创建了一个名为“Python: Current File”的调试配置。其中,"cwd"参数设置为"${fileDirname}",表示当前工作目录(CWD)为当前打开文件所在的目录。这样,无论是调试还是...
点击“创建启动文件”按钮,选择“Python”进行配置。 生成的launch.json文件可以保持默认设置,具体如下: {"version":"0.2.0","configurations":[{"name":"Python: Current File","type":"python","request":"launch","program":"${file}","console":"integratedTerminal"}]} ...
1. 安装Python扩展在VSCode的扩展商店中搜索并安装Python扩展。安装完成后,VSCode就会具备对Python的编写和调试能力。 2. 创建Python文件在VSCode中创建一个新的Python文件,或者打开一个已有的Python文件。 3. 配置调试器点击VSCode左侧的调试图标,在Debug视图中选择“创建 launch.json文件”。然后,选择Python环境,可以是...
linkid=830387"version":"0.2.0","configurations":[{"name":"Python: Current File","type":"python","request":"launch","program":"${file}","python":"/home/ml/anaconda3/envs/py36/bin/python",#这个是虚拟环境 conda info--envs 可以看虚拟环境的地址"console":"integratedTerminal","args":...
{"name":"Python: Current File","type":"python","request":"launch","program":"${file}",} 以下各节介绍各种设置的自定义配置。 name 提供出现在VS Code下拉列表中的调试配置的名称。 type 标识要使用的调试器的类型;将此设置留给pythonPython代码。
– 点击左侧的调试(Debug)按钮,在编辑器顶部选择Python:Current File并点击运行按钮,即可在VS Code中直接运行代码。 – 可以添加断点来调试代码,点击代码行号左侧空白处即可插入断点,在调试面板中可以查看变量值、逐步调试等。 7. 其他功能:VS Code还支持丰富的扩展功能,比如版本控制、代码片段等,可以根据自己的需求安...
{ "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal"} 保存该配置文件后,我们可以点击调试工具栏中的“绿色箭头”按钮来启动调试器。调试器将自动运行我们的代码,并在运行过程中暂停在我们设置的断点处。
{ "version": "0.2.0", "configurations": [ { "name": "Python: debug 1", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal", "justMyCode": true }, { "name": "debug 2", "type": "python", "request": "launch", "program": "$...