sublime text3配置python開發環境(windows版)
阿新 • • 發佈:2018-07-21
完成後 ext syn sub name roc path lan python開發
安裝階段:
-
sublime text3的安裝:
- 下載網址:https://www.sublimetext.com/
- 下載完成後 ,點擊安裝即可。
-
安裝Package Control:
- 點擊 Tools -> install Package Control
-
安裝anaconda:
- ctrl+shift+p -> 輸入install package -> 輸入anaconda -> 回車
-
安裝SublimeREPL:
- ctrl+shift+p -> 輸入install package -> 輸入 sublimeREPL -> 回車
-
安裝Djaneiro:
- ctrl+shift+p -> 輸入install package -> 輸入 Djaneiro -> 回車
配置階段:
-
配置SublimeREPL:
- Preferences -> Browse Packages -> SublimeREPL -> config -> python ->打開 Main.sublime-menu -> 找到
{"command": "repl_open", "caption": "Python - RUN current file", "id": "repl_python_run", "mnemonic": "R", "args": { "type": "subprocess", "encoding": "utf8", "cmd": ["python", "-u", "-i", "$file_basename"], "cwd": "$file_path", "syntax": "Packages/Python/Python.tmLanguage", "external_id": "python", "extend_env": {"PYTHONIOENCODING": "utf-8"} } },
修改其中的 "cmd" 項。
-
-
如果電腦上裝有python2和python
-
- 想要使用python2的cmd就填入 "cmd": ["python", "-u", "-i", "$file_basename"]
- 想要是要python3的cmd就填入 "cmd": ["python3", "-u", "-i", "$file_basename"]
-
-
如果電腦中只有一個python版本
-
- 直接填入"cmd": ["python", "-u", "-i", "$file_basename"]
-
-
-
自定義SublimeREPL快捷鍵
Preferences -> Browse Package -> SublimeREPL -> config -> python -> 打開Default.sublime-commands -> 找到
{ "caption": "SublimeREPL: Python - RUN current file", "command": "run_existing_window_command", "args": { "id": "repl_python_run", "file": "config/Python/Main.sublime-menu" } },
並復制到 Preferences -> Key Bindings 中,並在代碼中添加想要設置的快捷鍵,如下:
{ "keys": ["shift+f10"], //修改方括號中的內容,自定義快捷鍵 "caption": "SublimeREPL: Python - RUN current file", "command": "run_existing_window_command", "args": { "id": "repl_python_run", "file": "config/Python/Main.sublime-menu" } },
sublime text3配置python開發環境(windows版)