Sublime Text Editor configured Python interpreter Easy Tutorial

The day before yesterday encountered a small partner in the micro-letter asked me a question about Sublime text configured Python interpreter may be a beginner, this area is not really understand, want to use the keyboard shortcut, however futile, because of the lack Python interpreter, press the shortcut keys Ctrl + B will not get the desired results.

In view of this, if you want to use a small partner Sublime run Python programs, then configure the Python interpreter is an essential step in this consolidation process taught here, hope for the later paving the way. The following is a detailed tutorial:

1, first open Sublime, as shown below, and then select the "Preferences" tab.

2. Click on the first option "Browse Packages ...", then the system will automatically locate the Sublime installation package directory.

3, and later will pop up the folder interface.

4, to find the folder pile Python this folder, as shown below, and then into the folder, the file found Python.sublime-build.

5, open the file, as shown in the Sublime.


{

"cmd":["python.exe","-u", "$file"],

"path":"C:\Python34",

"file_regex": "^[ ]File"(...?)", line ([0-9]*)",

"encoding": "gbk",

"selector": "source.python"

}

Content is the content of the display after I updated, original content is not so rich. The main change is in two places, one is added Python interpreter path, the other is to add coding portion, coding is generally chosen or GBK utf-8, also with some of cp936, mainly to prevent Sublime Text messages [Decode error - output not wrong utf-8] of. In general, if we do not set the encoding of words, once the other languages ​​in addition to English output, there will be coding problem, a problem of skull pain of people, in general, several coding multi try not big problems.

6, after you've made changes Python.sublime-build file, press the shortcut keys Ctrl + S to save. After any open a Python file, then click the tab ToolsàBuild SystemàPython in the Sublime, as shown below, the entire process is equivalent to the completion of the Sublime and the Python interpreter perfect "tie."

7, you can press Ctrl + B or sequentially add tabs ToolsàBuild, shown below, can be run after the current file Python, the results as shown below. The output of the file under the Sublime, is generally exhibits a rectangular portion gray.

8, so far, about Sublime configured Python interpreter and [Decode error - output not utf-8] error problem has been successfully resolved.

The hope behind the junior partner encountered this problem again when you can avoid detours friends. Although small series currently using Sublime Text 2, but the configuration Sublime Text Sublime Text 2 and 3 is exactly the same, is omitted.

We will certainly encounter many difficulties when learning python, as well as the pursuit of new technologies, here's what we recommend learning Python buckle qun: 784758214, here is the python learner gathering place! ! At the same time, he was a senior development engineer python, python script from basic to web development, reptiles, django, data mining and other projects to combat zero-based data are finishing. Given to every little python partner! Daily share some methods of learning and the need to pay attention to small details

Click: Python exchange technology sharing

Guess you like

Origin blog.51cto.com/14318113/2408722