我把f5设置为python3的,f4是python2的
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"
}
},
{
"keys":["f4"],
"caption": "SublimeREPL: Python2 - RUN current fil",
"command": "run_existing_window_command",
"args": {
"id": "repl_python2_run",
"file": "config/Python2/Main.sublime-menu"
}
}
]
这只是设置快捷键,因为之前先安装了python3,所以运行的时候还要弄一个python2的便宜窗口
preferences–>Browse package
进到\SublimeREPL\config
本来有的是python,复制一份改为python2(如果你是给python3的可以改成python3)
最后会在tools–>sulimbeREPL里面显示
进到python2,修改Main.sublime-menu
将里面的的python改成python2,所有的,不管大小写
除了"syntax": "Packages/python/python.tmLanguage"
可以用“查找\替换”,把里面的python换成python2
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "R",
"id": "SublimeREPL",
"children":
[
{"caption": "python2",
"id": "python2",
"children":[
{"command": "repl_open",
"caption": "python2",
"id": "repl_python2",
"mnemonic": "P",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python2", "-i", "-u"],
"cwd": "$file_path",
"syntax": "Packages/python/python.tmLanguage",
"external_id": "python2",
"extend_env": {"python2IOENCODING": "utf-8"}
}
},
{"command": "python2_virtualenv_repl",
"id": "python2_virtualenv_repl",
"caption": "python2 - virtualenv"},
{"command": "repl_open",
"caption": "python2 - PDB current file",
"id": "repl_python2_pdb",
"mnemonic": "D",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python2", "-i", "-u", "-m", "pdb", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/python/python.tmLanguage",
"external_id": "python2",
"extend_env": {"python2IOENCODING": "utf-8"}
}
},
{"command": "repl_open",
"caption": "python2 - RUN current file",
"id": "repl_python2_run",
"mnemonic": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python2", "-u", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/python/python.tmLanguage",
"external_id": "python2",
"extend_env": {"python2IOENCODING": "utf-8"}
}
},
{"command": "repl_open",
"caption": "python2 - Ipython2",
"id": "repl_python2_ipython2",
"mnemonic": "I",
"args": {
"type": "subprocess",
"encoding": "utf8",
"autocomplete_server": true,
"cmd": {
"osx": ["python2", "-u", "${packages}/SublimeREPL/config/python2/ipy_repl.py"],
"linux": ["python2", "-u", "${packages}/SublimeREPL/config/python2/ipy_repl.py"],
"windows": ["python2", "-u", "${packages}/SublimeREPL/config/python2/ipy_repl.py"]
},
"cwd": "$file_path",
"syntax": "Packages/python/python.tmLanguage",
"external_id": "python2",
"extend_env": {
"python2IOENCODING": "utf-8",
"SUBLIMEREPL_EDITOR": "$editor"
}
}
}
]}
]
}]
}
]
python2
python3