使用编译器:sublime
python版本:Python27
1、安装package control
在输入框输入下面代码
import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.cn/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
这里注意:如果保存,查看报错最后关于h的值,然后修改h的两个值。
2、修改sublime text插件channels
3、汉化
通过package control,选择install package,安装下面内容
4、sublime配置python运行环境
(1)打开Tools > Build System > New Build System..
(2)修改配置,并保存为python2
配置代码(******代表Python安装路径,比如--D:/Development Tools/Python/python.exe):
{
"cmd": ["******","-u","$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
}
(3)新建项目测试
print(“hello world”)
5、安装编译插件(解决sublime原本的编译可能没办法自动输入下一行)
首先,Ctrl+Shift+p快捷键,弹出框框输入 install Package,回车后又弹出一个框,输入
SublimeREPL
(要安装的插件名字),回车后左下角显示
设置编译器快捷键:点击Preferences->Key Bindings。
输入这段内容:
[
{ "keys": ["f5"], "caption": "SublimeREPL:Python",
"command": "run_existing_window_command", "args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
}
]