One - One Code All

Blog Content

mac上配置visual studio code的python环境

Python Linux-Mac   2021-02-02 09:08:54

mac上配置visual studio code的python环境,有几点需要注意,

一是visual studio code 自带的插件不能使用,ms-python,仅适用于windows;

二是新版本不适用老配置了,提示报错信息:“The property showOutput is deprecated. Use the reveal property inside the presentation property instead. See also the 1.14 release notes. Also isShellCom...”


正确的做法:

shift + command + b 运行代码,此时会提示运行配置。点击配置运行程序。在弹出窗口点击其它设置。

这时候在文件夹下会自动生成配置文件。修改如下内容并保存:

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

重新使用shift + command + b命令,Python代码就可以运行了。


上一篇:查看Mac系统文件占用详情
下一篇:mac安装ta-lib

The minute you think of giving up, think of the reason why you held on so long.