新增Python3编译环境
Tools > Build System > New Build System将默认内容替换为:{ "cmd": ["python3", "-u", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python"}保存为 Python3.sublime-build
选中Python3环境
Tools > Build System > Python3
使用Python3编译运行
Ctrl + b
可能遇到的问题
问题
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
原因
默认是ascii编码但是输出中包含中文
解决
Preferences > Browse Packages > Users > Python3.sublime-build修改配置文件, 配置文件中新增一条"env": {"LANG": "en_US.UTF-8"}修改后如下:{ "cmd": ["python3", "-u", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python", "env": {"LANG": "en_US.UTF-8"}}