安裝
通過package control --> install package --> sublimeREPL
info
Python: 直接一個python界面瓦哎,可用來做簡單測試
Python-RUN current file: 運(yùn)行當(dāng)前python文件
Python-PDB current file: 調(diào)試當(dāng)前python文件
Python-IPython: 通過IPython shell 交互式運(yùn)行當(dāng)前python文件
更改python路徑(可選)
由于默認(rèn)的python路徑并不是我想使用的python路徑页眯,其默認(rèn)路徑需要被修改為我常用的python路徑
- 查找想要的conda虛擬環(huán)境的python完整路徑
- Open a terminal window.
- run
conda activate your-environment-name.
- Run
which python
復(fù)制顯示的路徑結(jié)果鉴扫,類似于/home/username/anaconda3/envs/env_name/bin/python
- 找到路徑文件
Preferences --> Browse Packages,
在跳出的文件夾中打開SublimeREPL --> config --> Python --> Main.sublime-menu -
修改路徑文件
把每一個“cmd”后方括號中的“Python”修改為第一步中復(fù)制的路徑, 保存Main.sublime-menu文件
修改路徑 -
回到sublime text窗口絮蒿, Tools --> SublimeREPL --> Python --> Python
python版本已改變
創(chuàng)建快捷鍵
Preferences --> Key Bindings, 在右側(cè)的空白欄輸入下面的代碼赊豌, F5 和 F8可按照自己喜好更改氏堤,但要確保和已定的不重復(fù), 輸入后保存档插,關(guān)閉sublime-keymap文件慢蜓。
[
{
"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"}
},
]
之后想要直接運(yùn)行當(dāng)前文件,按F5就可以了~