1 - 安裝Sublime Text 3
到官網下載對應的版本,如下:
- OS X (10.7 or later is required)
- Windows - also available as a portable version
- Windows 64 bit - also available as a portable version
- Ubuntu 64 bit - also available as a tarball for other Linux distributions.
- Ubuntu 32 bit - also available as a tarball for other Linux distributions.
根據提示一路"next"即可完成安裝。
2 - 安裝Package Control
Package Control時Sublime Text的包管理器(即管理插件用的),需要先安裝之后才能安裝插件,具體安裝方法參考其官方教程https://packagecontrol.io/installation。
3 - 配置Python開發環境
3.1 - Anaconda插件的安裝
該插件可以提供python代碼提示功能,而且他有python的所有類庫,並且有包管理功能,自動補全和語法提示,並且提供了“跳轉到定義”、“查找使用”、“顯示文檔”、“自動重命名”等功能。
在Sublime Text中使用快捷鍵$ctrl+shift+P$調出命令框,輸入install package進入,然后搜索Anaconda,選中進行安裝,等待安裝完成即可。
3.2 - SublimeREPL插件的安裝
在Sublime Text中使用快捷鍵$ctrl+shift+P$調出命令框,輸入install package進入,然后搜索SublimeREPL,選中進行安裝,等待安裝完成即可。
3.2 - 配置python快捷鍵
配置Python編譯模塊,讓編譯器能夠解析Python代碼。點擊Tools->Build System->New Build System,復制下面代碼粘貼進去,並且命名為Python3.sublime-build保存在默認路徑下。
{ "cmd": ["", "-u", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python", "encoding": "cp936", }
然后綁定編輯運行的按鍵,點擊Preferences->Key Buildings,然后輸入下面內容,第一行作用是綁定f2鍵為運行python文件,第二行作用是綁定f1鍵調出python交互命令模式。
[ { "keys": ["f2"], "caption": "SublimeREPL: Python", "command": "run_existing_window_command", "args": { "id": "repl_python_run", "file": "config/Python/Main.sublime-menu" } }, { "keys": ["f1"], "caption": "SublimeREPL: Python", "command": "run_existing_window_command", "args": { "id": "repl_python", "file": "config/Python/Main.sublime-menu"} } ]
f2功能如下:
f1功能如下:
4 - 參考資料
https://www.cnblogs.com/taoyoung/p/6528521.html