Sublime text2 Build Python build environment

Source: Internet
Author: User

0. Install Windows version of the Python compilation environment installation package, can be downloaded on the python.org Web site, this installation path is C:\Python27\

1. Click Preferences on the toolbar to open the browsing package browse Packages. Locate Python in the Open folder, and open the folder. Locate the file Python.sublime-build and open it.

Modify the following:

{

"cmd": ["Python", "-U", "$file"],

"Path": "c:/python27/",

"File_regex": "^[]*file \" (... *?) \ ", line ([0-9]*)",

"Selector": "Source.python"

}

Modify the contents of the path to the compiler's installation directory. Save the code, CTRL+B can run

2. Install SUBLIMEREPL, configure Python interactive running environment

Sublimerepl,repl is the read-evaluation-print-loop, the process of interpreting language compilation runs. The SUBLIMEREPL plugin also supports direct compiler runs and interactions on the editor

2.1 Configure Python to run the current file directly

This is the direct interactive run of the current file name of the menu named: python_console_integrated.

windows open x:\xxx\SublimeText2\Packages\SublimeREPL\config\Python\Main.sublime-menu files, different environments may have different paths, find "id": "Repl_ Python's line, change the value of the args attribute under this JSON object to ["Python", "I", "-U", "$file _basename"], as shown in figure:


2.2 Keep the original interactive terminal function:

This is the menu name for running the Python Interactive terminal independently: Python_console_standalone,

Add one of the following configured nodes to the above file, and be aware that changing caption,id and cmd,id is not the same name as the file above



2.3 Click perferences-Keyboard bindings-user or default key bindings-users or defaults, set shortcut keys.


Where the ID value is the ID value in the JSON object in python_console_integrated, the keys can be selected by themselves, this time for F5


4. After the configuration is complete:

4.1 Run the program directly using CTRL+B without the need for interactive running.

4.2 Use F5 to run the current file when you need to interact with it directly.

4.3 If you just want to pull up a standalone Python interactive terminal without running the current file, call the standalone interactive terminal as follows: (Of course, you can also configure the shortcut keys for stand-alone terminals as described above, not configured this time)



5, add the third party package and module library path:

Open Python.sublime-build, join

"env": {"Pythonpath": "D:/python/lib"}
After that, you can put the third party modules all into the D:\python\lib directory.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.