然后cmd查看一下python的版本
python -V
这样就算python环境变量配置成功了。
有两种安装方式:
通过" View > Show Console " 菜单打开下面的控制台,然后将下面的代码贴到控制台中去,回车
import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
1、点击 Preferences > Browse Packages… 菜单
2、Browse up a folder and then into the Installed Packages/ folder
3、Download Package Control.sublime-package and copy it into the Installed Packages/ directory
4、Restart Sublime Text
下载解压这个包后把这个复制到Packages下面然后改名成Package Control (通过Preferences–>Browse Packages–>Packages)
{
"cmd": ["D:/Anaconda3/python.exe","-u","$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env": { "PYTHONIOENCODING": "utf8" }
}
新建test.py文件,输入简单python语句,按Ctrl+B运行
(注意:记得先保存文件再运行,不然会报错)
打开Preferences –>>Settings(Settings User),在右侧添加如下代码(font_face及font_size可根据个人喜好去进行相应的更改)
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
"font_face": "Consolas",
"font_size": 14,
"ignored_packages":
[
"Vintage"
],
"update_check": false,
// The number of spaces a tab is considered equal to
"tab_size": 4,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": true,
//设置保存时自动转换
"expand_tabs_on_save": true
}
:Full-featured code intelligence and smart autocomplete engine
操作步骤:
1.Control+Shift+P打开Package Control控制台
2.输入install,选择关联出来的install package
3.输入sublimecodeintel,然后点击列表提示的sublimecodeintel安装
4.安装完成之后,文本框会出现如下显示,或者可以通过【Preferences>Package Settings】中查看到已安装的sublimecodeintel插件
5.打开preferences->packages settings ->Package Control ->Settings-User,检查是否有如下红框代码,如果没有得手动添加
6.点击preferences中的browse Packages,进入SublimeCodeIntel文件夹,在当前的路径下新建.codeintel文件夹,之后进入到 .codeintel文件夹中,新建文件“config.log”文件,打开输入(以路径“D:\Anaconda3”为例,实际配置时请根据你的具体安装路径修改):
"python3":{
"python":"D:/Anaconda3/python.exe",
"pythonExtraPaths":[
"D:/Anaconda3/DLLs",
"D:/Anaconda3/Lib",
"D:/Anaconda3/Lib/lib-tk",
"D:/Anaconda3/Lib/site-packages",
]
}
效果如下:
7.ctrl+s 保存,然后重启Sublime Text 3
添加快捷键后,可直接运行当前文件,非常方便
操作步骤:
1、安装SublimeREPL插件后,打开Preferences->Key Bindings,添加快捷键:
[
{
"keys": ["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command",
"args": {
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
}
]
如下图:
2、然后新建一个测试文件(test.py),如下:
3、上文中SublimeREPL插件设置的快捷键是F5,所以按F5运行成功如下:
安装此插件后,可以通过快捷键按照模板快速新建文件
操作步骤:
1、安装SublimeTmpl插件后,打开Preferences->Package Settings->SublimeTmpl->Settings User,添加如下内容:
{
"disable_keymap_actions": false, // "all"; "html,css"
"date_format" : "%Y-%m-%d %H:%M:%S",
"attr": {
"author": "Yong Lee",
"email": "[email protected]",
"link": "http://www.cnblogs.com/honkly/"
}
}
2、添加快捷键,打开Preferences->Key Bindings,添加红框中的快捷键代码:
[
{
"caption": "Tmpl: Create python", "command": "sublime_tmpl",
"keys": ["ctrl+alt+n"], "args": {"type": "python"}
},
{
"keys": ["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command",
"args": {
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}
}
]
3、然后打开Sublime Text 3,SublimeTmpl插件设置的快捷是"Ctrl+alt+n",按快捷键后成功新建文件。
《ps:还有好多好多的插件,不一一列举了,君可以去探索更多哦!!!》