配置run 运行相关
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",
"program": "${file}",
"cwd": "${workspaceRoot}",
"console": "integratedTerminal",
"env": {
"PYTHONPATH":"${workspaceRoot}"}
}
]
}
code runner 配置
settings.json
{
"python.pythonPath": "venv\\Scripts\\python.exe",
"code-runner.executorMap": {
"python": "$pythonPath -u $fullFileName",
},
"code-runner.saveFileBeforeRun": true,
"code-runner.runInTerminal": true,
// 将项目路径添加到python path变量中
"terminal.integrated.env.windows": {
"PYTHONPATH":"${workspaceRoot}"
},
// 单元测试
"python.testing.pytestArgs": [
"test"
],
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": false,
"python.testing.promptToConfigure": false
}