1. PrefaceUsing the sublime Text 2 configuration Python environment, there are simple configuration and like idle configuration, this article is divided into the first part and the second part.
2. ConfigurationThe first part (simple configuration) 1. Just open Preferences Browse packages to find the Python.sublime-build file in the Python folder.
2. Add our path to install Python OK.
3.Sublime TEXT2 will automatically determine the type of build byCtrl + B to run
The output is deployed to this step in its own console and can be used normally.
P.S. If the Ctrl + B prompt prompts can ' t find ' __main__ ' module in ', stating that you do not save this file, hahaha link:http://blog.csdn.net/lhshu2008/article/ details/24780153 But there's a problem here that can't be entered as idle, and we can use a plug-in SUBLIMEREPL at this point. --------------------------------------------------------------------------------------------------------------- ----The second part (use as idle) if your ST2 has not installed the ' install Package Manager ' Simple installation method: Use CTRL + ' shortcut key or open the command line via the View->show console menu, paste the following code: if it is sublime Text 2:
ImportUrllib2,os; pf='Package Control.sublime-package'; IPP = Sublime.installed_packages_path (); Os.makedirs (IPP)if notOs.path.exists (IPP)ElseNone; 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('Restart Sublime Text to finish installation')
If it is sublime Text 3, the code is as follows:
Import ' Package Control.sublime-package ' ' WB ' ' http://sublime.wbond.net/ ' + pf.replace (','%20'). Read ())
If it goes well, you can see the package settings and the package control two menus under the Preferences menu now.
4.first install this plug-in, the installation process is Ctrl+shift+p,install packag, such as repo information appears, input SUBLIMEREPL, such as:You can see Sublimerepl in preference->package settings, which means the installation is successful.5. RunningSince every run of the program executes: the run current File menu, SUBLIMEREPL, Tools----is a bit cumbersome, so you can now consider creating a shortcut key for him; Perferences-Key Bindin Paste the following code in the GS User:
[{"keys":["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command", "args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}}]
So after you open the Python program you want to run, you can press the shortcut key F5build to execute it directly. But each run out of the new *repl*[python] output file, it feels not very convenient. And a new *repl*[python] output file will be created if it is not a Python file or an illegal file is compiled by shortcut
Or
We can actually run Python like idle and set a shortcut as follows
[
{"keys":["f5"],
"caption": "SublimeREPL: Python - RUN current file",
"command": "run_existing_window_command", "args":
{
"id": "repl_python_run",
"file": "config/Python/Main.sublime-menu"
}},
{"keys":["f4"],
"caption": "SublimeREPL: Python",
"command": "run_existing_window_command",
"args":
{
"id": "repl_python",
"file": "config/Python/Main.sublime-menu"
}}
]
3. ReferencesSublime Text3 Installation sublimerepl--Troubleshoot problems that cannot run input () sublime Text3 and Sublimerepl use virtualenv to execute Python
Configure the Python runtime environment for Sublime TEXT2 (Sublime Text 3 is similar)