sublime text之python
1、安装插件:
ctrl+shift+p、install package、插件名称
2、直接运行python文件:
ctrl+B
3、sublime text安装python:(链接:https://www.zhihu.com/question/22904994/answer/87527103)
1、安装package control:
View->Show Console
1 import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
(可能会提示重启sublimetext)
确认Preferences菜单有Package Settings和Package Control两个菜单;
1 import urllib2,os; pf='Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), 'wb' ).write( urllib2.urlopen( 'http://sublime.wbond.net/' +pf.replace( ' ','%20' )).read()); print( 'Please restart Sublime Text to finish installation')
2、安装sublimeREPL:
Ctrl+shift+p
install packages
SublimeREPL
确认Tools->SublimeREPL->Python
3、快捷键设置F1:
Preferences->Key Bindings-User
1 [{"keys":["f1"], 2 "caption": "SublimeREPL: Python - RUN current file", 3 "command": "run_existing_window_command", "args": 4 {"id": "repl_python_run","file": "config/Python/Main.sublime-menu"} 5 }]
ctrl+s
之后可以直接F1执行。