Configure Python
- Download Sublime Text 3:https://www.sublimetext.com/3
- Open Tools> Build System> New Build System and add the following code
{
"cmd": ["D:\\Python\\python.exe","-u","$file"],
"path": "D:\\Python\\python.exe",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"encoding": "utf-8" ,
"env": {"PYTHONIOENCODING": "utf8"}
}
- Ctrl+s save as python3.sublime-build
- Open Preferences> Settings(Settings User) and add the following code on the right
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
"theme": "Adaptive.sublime-theme",
"font_size": 12,
"ignored_packages":
[
"Vintage"
],
"update_check": false,
// 1个Tab等于4个空格
"tab_size": 4,
// 将Tab转换为空格
"translate_tabs_to_spaces": true,
// 设置保存时自动转换
"expand_tabs_on_save": true,
// 保存时自动去除行末空白
"trim_trailing_white_space_on_save": true,
// 默认编码格式
"default_encoding": "UTF-8",
}
- Open Tools> Build System> python3 and enter verification
Configure plugin
Open the Command Palette: Win/Linux: ctrl+shift+p , Mac: cmd+shift+p , type Install Package Control , and press Enter
Install SublimeREPL
- Press Ctrl+Shift+P , open the command box, enter Install , select " Package Control: Install Package ", then enter SublimeREPL in the newly appeared command box, and press Enter
- Run mode 1: tools> sublimeREPL> python> python run current file
Run mode 2: set shortcut keys
[
{ "keys": ["f5"], "caption": "SublimeREPL:Python",
"command": "run_existing_window_command",
"args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
},
]
Install Anaconda
- Press Ctrl+Shift+P , open the command box, enter Install , select " Package Control: Install Package ", then enter Anaconda in the newly appeared command box, and press Enter
- Open Preferences> Package Settings> Anaconda> Settings-User and add the following code
{
//由于Anaconda插件本身无法知道Python安装的路径,所以需要设置Python主程序的实际位置
"python_interpreter": "D:\\Python\\python.exe",
//忽略各种空格不对, 超过79字, import的函数没有使用的提醒,
"pep8_ignore": ["E501", "W292", "E303", "W391", "E225", "E302", "W293", "E402"],
"pyflakes_explicit_ignore":
[
"UnusedImport"
],
//保存文件后自动pep8格式化
"auto_formatting": true,
"auto_formatting_timeout": 5,
//库函数的提示
"enable_signatures_tooltip": true,
"merge_signatures_and_doc":true,
//ST3也有自动补全提示,但只提示文件中输入过的单词,这个功能可用提示变量可用的函数等。
"suppress_word_completions": true,
"suppress_explicit_completions": true,
"complete_parameters": true,
//代码排版时,行的默认长度太短,根据喜好设置
"pep8_max_line_length": 120,
"env": {"PYTHONIOENCODING": "utf8"},
}