【VSCode中Python的Debug调试配置】

如果 Debug 调试 没有反应,可以自行创建添加这三个文件,修改其中的 Python 环境的解释器路径地址,进行解决。
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
// "version": "0.2.0",
// "configurations": [
// {
// "name": "Python: 当前文件",
// "type": "python",
// "request": "launch",
// "program": "${file}",
// "console": "integratedTerminal"
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"python": "D:\\Anaconda\\python.exe",
"program": "${file}",
"cwd": "${workspaceRoot}",
"env": {},
"envFile": "${workspaceRoot}/.env",
"redirectOutput": true,
}
]
}
-
不同的虚拟环境,Python解释器的路径不同:  -
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "python",
"type": "shell",
"command": "D:\\Anaconda\\python.exe",
"args": [
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$eslint-compact"
]
}
]
}
{
"python.pythonPath": "D:\\Anaconda\\python.exe"
}

|