准备:

  • 安装python
  • 安装vscode

配置task.json 文件:

   {
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "Run Python",
            "type": "shell",
            "command": "python",
            "args": [
                "${file}"
            ],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": true,
                "panel": "shared"
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

配置 user settings 文件:

打开软件在首选项中找到"设置"并打开

"python.pythonPath": "x:/python3.6.5/python"

设置python所在位置路径

运行测试

保存重启以后,新建一个**.py文件,写个print("hello python")

ctrl+shift+B 运行即可