1. 安裝 SublimeREPL 插件html
等待一下,輸入sublimerepl,選擇sublimeREPL
,而後它就會在後檯安裝。python
安裝完以後,查看以下圖app
選擇你要執行的*.py文件,經過這個路徑,選擇 Python -RUN current file就能夠直接執行*.py程序了,選擇Python-PDB current file 就能夠調試*.py程序。可是每次執行代碼都要到這個很長的路徑下選擇,確實很麻煩。函數
2.設置SublimeREPL運行的Python環境spa
在你的Sublime Text 3的路徑下,個人是...\Sublime Text 3\Data\Packages\SublimeREPL\config\Python\ 找到Main.sublime-menu文件,而後用Sublime Text 3 打開,找到id 爲 repl_python行,修改 "cmd": ["python", "-i", "-u","$file_basename"],保存。插件
這樣至關於將SublimeREPL的python交互環境的命令改成運行當前文件的交互環境。3d
3.快捷鍵設定。調試
在路徑:Preferences->Key Bindings code
輸入以下代碼:htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
[
{
"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"
: [
"f8"
],
"caption"
:
"SublimeREPL: Python - PDB current file"
,
"command"
:
"run_existing_window_command"
,
"args"
: {
"id"
:
"repl_python_pdb"
,
"file"
:
"config/Python/Main.sublime-menu"
}
},
]
|
效果以下:
這裏定義了 f5 直接運行*.py文件,f8調試*.py文件。
4. 調試*,py的命令
本文轉自:https://www.cnblogs.com/JackyXu2018/p/8821482.html