sublime修改python解释器

今天使用sublime发现导入第三方库的时候死活找不到,而我在REPL 中则完全没有问题,最终发现两个用的不是同一个解释器,也就是说我要用自己安装的python解释器而不是sublime默认的,那么如何修改就成了问题了,查找资料发现下面方法,经测试没有问题

Tools->build system->new build system

{
    "shell_cmd": "python -u \"$file\"",/*修改*/
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "env": {"PYTHONIOENCODING": "utf-8"},
    "variants":
    [
        {
            "name": "Syntax Check",
            "shell_cmd": "python -m py_compile \"${file}\"",/*修改*/
        }
    ]
}

如果使用的是python3改成

"shell_cmd": "python3 -u \"$file\""

然后在Tools->build system中选择自己定义的解释器

猜你喜欢

转载自blog.csdn.net/xtfge0915/article/details/52368350