vscode中launch.json

描述

简单的一键F5运行当前文件。

样例

{
    // 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}",
            "console": "integratedTerminal",
            "cwd": "${workspaceFolder}",
            "args": [],
            "pythonPath": "${command:python.interpreterPath}"
        }
    ]
}

常用

"cwd":执行代码的路径。
"args":参数。["--input", "", "--output", ""]
"pythonPath": "${command:python.interpreterPath}" //终端中的python。
也可以直接设置为conda虚拟环境中的python(python.exe的绝对路径)

原文地址:https://www.cnblogs.com/yubo455/p/13821726.html