Edit Python in Sublime

Source: Internet
Author: User
Tags sublime text

Python has a lot of editors, you can use CMD to learn, but today I still talk about editing python with sublime.

Because Python is an explanatory language, we want the input to be output. Such as:

How to get such an editing environment? Let's take a step-by-step implementation

The first step: Download Python,

Because there are two big versions, the 2 series and the 3 series, I use the 2 series here, because ArcGIS uses the 2 series, so I downloaded version 2.7. Download on Baidu Bar, if you are as much as I use. NET may feel the environment variable trouble in the process of installation notice these two to choose:

In fact, environment variables these settings are also very good, habit is good. Such settings as environment variables are necessary in Java development, after all, the domestic environment with more Java. Although I also intend to use Java in the next stage, but I would like to say: Java capable. NET is as competent, not inferior, only to see how your. NET Foundation.

Step two: Download Sublime 3

. Address: Https://download.sublimetext.com/Sublime Text Build 3143 x64 Setup.exe, installation is the next step, the next step, specifically do not say.

Step three: Set Sublime 3

Setting up sublime requires several steps,

1. Sublime text can use the package Control to make it easier to browse, install, and uninstall plugins.

2. How do I install the package control?

You can refer to the installation steps provided on the Package control website

(1) using [Ctrl + '] (or view > Show Console menu) to open the sublime text console, paste the following Python code into the console:

Import Urllib.request,os,hashlib; h = ' 7183a2d3e96f11eeadd761d777e62404 ' + ' e330c659d4bb41d3bdf022e94cab3cd0 '; 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.pat H.join (IPP, PF), ' WB '). Write (by)

Note: The above code will change depending on the version, so it is best to take "1" to copy the code.

(2) If not installed automatically, "1" also provides a manual (Manual) installation method, specific practices can go to the official website reference

(3) If you see the package control item in Perferences->package settings, the installation is successful.

3. Plugins

In Python development There are some very useful plug-ins, can be very good to improve the development efficiency, the following are some of the plugins I use

? Package Control: Plug-ins for managing plugins, previously installed

? Sublimecodeintel: Code hint plugin, can be based on Python, Java and other automatic code hints

Installation steps:

Open Package Control[preferences>>package Control]

Enter install to select the associated install package

The next step is to wait a moment, waiting for the following interface to appear:

This inside input: Sublimecodeintel (code hint), find and install, and then repeat the previous step, enter: Sublimerepl (you can run the current program directly), after the installation is complete.

Next, set the Python path,

(1) Open Sublimetext

Find tools--> Compilation system on the menu bar--New compiled system

(2) Enter the following configuration in the new configuration file

{

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

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

"Selector": "Source.python",

"Encoding": "cp936",

}

Where *********** fill in your computer with the Python installation path

(3) Ctrl+s Save to Sublimetext-->data-->packages-->user

Save the file name as Python.sublime-build.

Then restart Sublime.

To display the first interface in the article, you need to do the following: Tools-sublimerepl-python, the configuration is complete.

Edit Python in Sublime

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.