在Package Control: Install Package中,输入SublimeREPL就会自动安装好REPL插件。REPL插件配合分屏功能使用体验更好。
1、Linux下Sublime3默认调用的是python2,而不是python3,这就导致在编译python程序的时候,可能会报一些错误,比如在python文件中使用input函数,由于input函数是python3的函数,而REPL插件如果默认调用python2解析python文件,那么就会导致程序报错:
File "<string>", line 1, in <module> NameError: name 'xxxx' is not defined
这时候就需要手动设置sublimeREPL调用python3来解析python的文件。
2、设置快捷键
Sublime Text 3-> Preferences-> Key Bindings
3、输入下列内容并保存
[
{
"keys":["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command",
"args": {
"id": "repl_python_run",
"file": "config/Python3/Main.sublime-menu"}
} ,
{
"keys": ["f8"],
"caption": "SublimeREPL: Python - PDB current file",
"command": "run_existing_window_command",
"args": {
"id": "repl_python_pdb",
"file": "config/Python3/Main.sublime-menu"}
}
]
4、配置编译系统
Preferences-> Browse Packages
打开SublimeREPL->config文件夹
新建Python3文件夹,并添加下列文件
Default.sublime-commands
Main.sublime-menu
5、修改Default.sublime-commands,内容如下:
[
{
"captio