Sublime配置Python开发环境

Sublime is a great editor. This article mainly introduces how to make sublime compile python.

Posted by Dusign on 2017-05-19
Words 249 and Reading Time 1 Minutes
Viewed Times

Sublime text3是一款跨平台的非常好用的编辑器,插件多,界面酷,属于轻量级的编辑器。经过配置,可以作为Python的编译器使用,下面是我的配置方法,以Windows为例。

安装Python

直接去Python官网下载安装,安装比较简单,这里不再赘述
python

配置Sublime

点击Tools -> Build System -> New Build System…

复制下面的代码

1
2
3
4
5
6
{
"cmd": ["D:\Python36\python.exe","-u","$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"encoding": "cp936",
}

“D:\Python36\python.exe” 是你的python安装路径,然后保存为 Python.sublime-build

测试

再编辑器里新建Python文件,输入下面代码

1
2
3
4
5
6
array = [1,2,5,3,6,8,4]
for i in range(len(array)-1,0,-1):
for j in range(0,i):
if array[j]>array[j+1]:
array[j],array[j+1] = array[j+1],array[j]
print (array)

然后按 Ctrl+b 会出现如下图所示的运行结果,说明配置成功
result


If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !

...

...

00:00
00:00