sublime text3上设置 python解释器

1. 打开Sublime text 3 安装package control

2. 安装 SublimeREPL

Preferences -> package control 或者Ctrl+shift+p

键入 install packages稍等片刻后

键入 SublimeREPL 安装即可。(由于种种原因,在国内直接通过package control安装插件时,一定概率会出现网络异常。可以FQ解决,或者等网络正常后安装。)

3.设置安装路径

在 Preferences -> Package Settings -> SublimeREPL -> Settings - User里面保存自己安装Python的路径就好了,比如:

{
"default_extend_env": {"PATH":"C:\\python32\\"},  # 替换 "C:\\python32\\" 为自己的安装路径即可。
}

4.键位绑定

安装完成之后,可以通过 Tools -> SublimeREPL -> Python -> Python - RUN current file 这样的方式来启动解释器运行程序。或者Tools -> SublimeREPL -> Python -> Python 启动交互式解释器。

但是每次都这样特别的繁琐。最好有一个一键式启动。

以下方式可以绑定 f1 键为交互式解释器, f2 键为直接编译当前文件。

进入Preferences -> Key Bindings-User

 1 [
 2     {"keys":["f1"],
 3     "caption": "SublimeREPL: Python",
 4     "command": "run_existing_window_command", "args":
 5     {"id": "repl_python",
 6     "file": "config/Python/Main.sublime-menu"}},
 7 
 8     {"keys":["f2"],
 9     "caption": "SublimeREPL: Python - RUN current file",
10     "command": "run_existing_window_command", "args":
11     {"id": "repl_python_run",
12     "file": "config/Python/Main.sublime-menu"}},
13 
14 ]
Key Bindings-User

5.使用

比原生态的交互式解释器好看太多。


参考:1.知乎https://www.zhihu.com/question/22904994/answer/87527103


猜你喜欢

转载自www.cnblogs.com/dongye95/p/8984947.html