天天看点

Sublime text 3 python for linux 我的配置

Sublime text 3 python for linux 我的配置

这篇文章主要解决三个python原始配置在linux sublime text 3 中的问题:

  1. python3 而不是 python
  2. 解决用户无法输入问题
  3. 解决命令行闪退问题

打开 Tools --> Build System --> New Build System

添加:

{
	"shell_cmd": "python3 -u \"$file\"",
	"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
	"selector": "source.python3",

	"env": {"PYTHONIOENCODING": "utf-8"},

	"variants":
	[
		{
			"name": "Syntax Check",
			"shell_cmd": "python3 -m py_compile \"${file}\""
		},

		{
			"name": "Run",
			"shell_cmd": "x-terminal-emulator -e \"python3 -u \"${file}\" ; bash -c read\""
		}
	]
}

           

并保存为后缀为python3.sublime-build的文件

大功告成