介绍
添加快捷键后,可直接运行当前文件,非常方便
Launch python in local or remote(1) virtualenv.
Quickly run selected script or launch PDB.
Use SublimeText Python console with history and multiline input.
使用方法
1、安装SublimeREPL插件后,打开Preferences->Key Bindings,添加快捷键:
代码粘贴:
[
{
"keys": ["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command",
"args": {
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
}
]
测试
1、新建test.py文件,例如:
2、上文中SublimeREPL插件设置的快捷键是F5,所以按F5运行成功如下
如果出现以下报错信息(C:\Python\Python36\python.EXE: can‘t open file ‘$file_basename‘: [Errno 2] No such file or directory)说明你的python程序没有保存运行导致的结果,
解决方法是 先保存您要运行的python文件,在使用F5运行。
SublimeTmpl
介绍
安装插件后,可以通过快捷键按照模板快速新建文件
使用方法
1、安装SublimeTmpl插件后,打开Preferences->Package Settings->SublimeTmpl->Settings User,添加以下内容
{
"disable_keymap_actions": false, // "all"; "html,css"
"date_format" : "%Y-%m-%d %H:%M:%S",
"attr": {
"author": "wxwinder",
"微信公众号":"透雾",
"email": "bravexz@163.com",
"link": "http://www.cnblogs.com/bravexz/"
}
}
如图:
2、添加快捷键,打开Preferences->Key Bindings,添加红框中的快捷键代码
[
{
"caption": "Tmpl: Create python", "command": "sublime_tmpl",
"keys": ["ctrl+alt+n"], "args": {"type": "python"}
},
{
"keys": ["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command",
"args": {
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
}
]
如图:
测试
打开Sublime Text 3,上文中SublimeTmpl插件设置的快捷键是"Ctrl+alt+n",按快捷键后成功新建文件如下
ColorSublime
介绍
提供了主题更换功能,可根据个人喜好选择
使用方法
1、安装ColorSublime插件完成后,打开Preferences->Color Scheme...,选择主题
Anaconda
介绍
代码提示等许多功能,必备
安装方法
1、Preferences->Package Settings->Anaconda->Settings Default,修改"python_interpreter"为实际Python安装路径
2、Preferences->Package Settings->Anaconda->Settings User,添加如下内容
{
"python_interpreter":"C:/Python/Python36/python.exe",
"suppress_word_completions":true,
"suppress_explicit_completions":true,
"comlete_parameters":true,
"swallow_startup_errors":true,
"anaconda_linting":false
}
如图:
测试
1、打开Sublime Text3,新建任意*.py文件,输入语句测试,如图