


Simple tutorial for configuring Python interpreter in Sublime Text editor
The day before yesterday, I met a friend on WeChat who asked me a question about configuring the Python interpreter for Sublime text. He may be a beginner and doesn’t know much about this aspect. He wanted to use shortcut keys but it was in vain because he lacked Python. Interpreter, pressing the shortcut key Ctrl B directly will not get the desired result.
In view of this, if anyone wants to use Sublime to run Python programs, then configuring the Python interpreter is an essential step. Here, the editor has compiled this step-by-step tutorial, hoping to pave the way for newcomers.
The following tutorial column will introduce to you how to configure the Python interpreter in the Sublime Text editor: 1. First open Sublime, as shown in the figure below, and then select the "Preferences" tab. 2. Click the first option "Browse Packages...", and then the system will automatically locate the Sublime installation package directory.
3. Then the folder interface as shown below will pop up.
4. Find the Python folder in this pile of folders, as shown in the figure below, then enter the folder and find the Python.sublime-build file.
5. Open the file in Sublime, as shown in the figure below.
{ "cmd":["python.exe","-u", "$file"], "path":"C:\Python34", "file_regex": "^[ ]File"(...?)", line ([0-9]*)", "encoding": "gbk", "selector": "source.python" }
The content shown in the picture is the content after I updated it. The original content is not so rich. Mainly to change two places, one is to add the Python interpreter path, and the second is to add the encoding part. Generally, the encoding chosen is utf-8 or gbk, and some use cp936, mainly to prevent Sublime Text from reporting [Decode error - output not utf-8] error. Generally speaking, if we do not set the encoding, once the output is in a language other than English, encoding problems will occur, which is a headache. Generally, it is not a big problem if you try several encodings.
6. After changing the Python.sublime-build file, press the shortcut key Ctrl S to save it. Then open a Python file at will, and then click the tab ToolsàBuildSystemàPython in Sublime, as shown in the figure below. The whole process is equivalent to completing the perfect "connection" between Sublime and the Python interpreter.
7. Now you can use the shortcut key Ctrl B or add the tab ToolsàBuild in sequence, as shown in the figure below, and then you can run the current Python file. The effect is as shown in the figure below. The output part of the file is below Sublime, usually a gray rectangular part.
8. At this point, the problem of configuring the Python interpreter in Sublime and the [Decode error - output not utf-8] error has been successfully solved.
I hope that when future friends encounter this problem again, they can avoid detours. Although the editor is currently using Sublime Text 2, the configuration method of Sublime Text 3 is exactly the same as Sublime Text 2, so I won’t go into details.
The above is the detailed content of Simple tutorial for configuring Python interpreter in Sublime Text editor. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Below, the sublime tutorial column will introduce to you how to turn off automatic updates in Sublime Text. I hope it will be helpful to friends in need!

Development tools and debugging skills for PHP and CGI: Improving development efficiency Summary: PHP and CGI are two commonly used web development languages. In order to improve development efficiency, developers need to master some special development tools and debugging skills. This article will introduce several commonly used PHP and CGI development tools, as well as some debugging techniques to help developers develop and debug more efficiently. 1. Development tool SublimeTextSublimeText is a powerful text editor that supports PHP and C

SublimeText is a very popular code editor that is widely used by developers and code writers. In the following article, we will discuss the reasons and solutions for why SublimeText cannot run PHP.

PHP is a popular server-side scripting language that is widely used for web development. In order to write efficient and streamlined PHP code, programmers need to use an excellent code editor. This article will introduce some common code editors in PHP programming. SublimeTextSublimeText is probably one of the most popular code editors. Its flexibility and ease of use make it the editor of choice for many developers. Key features of SublimeText include: High degree of customization

Introduction to the recommended configuration for using SublimeText for C/C++ programming on Linux: SublimeText is a lightweight, powerful and highly customizable text editor. On Linux platforms, using SublimeText for C/C++ programming is a common choice. This article will introduce some recommended configurations and plug-ins to help improve programming efficiency and development experience. Install SublimeText: First, you need to install SublimeText from the SublimeText official website

In current web development, PHP has become a very popular back-end programming language. However, when developing PHP, choosing high-quality editors and development tools can greatly improve development efficiency and code quality. This article will introduce some common PHP editors and development tools. PHPStormPHPStorm is an integrated development environment (IDE) launched by JetBrains. It provides a series of functions such as powerful PHP development support, code analysis, debugging, and automated testing, and supports

How to build PHP with sublime: 1. Open sublime, click "Ctrl+Shift+P", and then enter install; 2. Configure SublimeLinter; 3. Modify the path; 4. Configure the PHP compilation system; 5. Add "{ "cmd": ["php","$file"],"file_regex": "php$","selector":"source.php"}" is enough.

PHP is a popular programming language that is widely used to create dynamic websites, applications, and a range of internet technologies. PHP has a large number of built-in functions to help programmers work more efficiently while writing code. If you use SublimeText as your editor, there are some plugins and tricks you can use to make your PHP functions easier to edit and use. In this article, I will introduce some useful SublimeText features that can help you make better use of PHP functions. 1.from
