1、新装VScode,需要安装python插件
2、安装完成后点击debug按钮,再点击设置按钮,修改launch.json文件配置需要调试相关信息
{
// 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",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"python": "D:\\ProgramData\\Anaconda3\\envs\\qt\\python.exe",
"program": "${file}",
"cwd": "${workspaceRoot}",
"env": {},
"envFile": "${workspaceRoot}/.env",
"redirectOutput": true,
}
]
}
3、配置完lauch.json之后还需要配置setting.json,在setting.json中需要配置python解释器路径(这一步要配置,不配置在lauch.json中会报错)
{
"python.pythonPath":"D:\\ProgramData\\Anaconda3\\envs\\qt\\python.exe",
}
4、点击vscode左下角配置python解释器,会弹出环境上所安装的python解释器,选择一个就可以(可以不管这一步)
5、配置完之后点击调试插件中的运行按钮就可以开始调试