文章前言
当我们自定义python的安装路径且在python2与python3并驾齐驱的情况下Sublime往往直接运行python脚本时会出现错误,本篇文章即介绍如何在Sublime中配置python环境
环境配置
Step 1:打开 Tools > Build System > New Build System :
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"
}
Step 3:保存
Step 3:重启Sublime text 3并选择python39
Step 4:再次运行python脚本