Sublime配置Python运行环境

文章前言

当我们自定义python的安装路径且在python2与python3并驾齐驱的情况下Sublime往往直接运行python脚本时会出现错误,本篇文章即介绍如何在Sublime中配置python环境

环境配置

Step 1:打开 Tools > Build System > New Build System :

Sublime配置Python运行环境_第1张图片

Step 2:输入以下内容(路径自我调整)

{
    "encoding": "utf-8",  
    "working_dir": "$file_path",  
    "shell_cmd": "E:\\Application\\Environment\\Python\\Python39\\python3.exe -u \"$file\"",  
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",  
    "selector": "source.python"  
}

Sublime配置Python运行环境_第2张图片

 Step 3:保存

Sublime配置Python运行环境_第3张图片

Step 3:重启Sublime text 3并选择python39

Sublime配置Python运行环境_第4张图片

Step 4:再次运行python脚本

Sublime配置Python运行环境_第5张图片

你可能感兴趣的:(python,sublime,text,开发语言)