search
HomeDevelopment ToolssublimeSimple 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.

Simple tutorial for configuring Python interpreter in Sublime Text editor

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!

Statement
This article is reproduced at:aliyun. If there is any infringement, please contact admin@php.cn delete
Is Sublime Text Free? Understanding the LicensingIs Sublime Text Free? Understanding the LicensingMay 09, 2025 am 12:10 AM

SublimeTextisfreeduringanunlimitedtrial,buta$99licenseisrecommendedforregularuse.1)Thetrialallowsfullfeatureaccesswithouttimelimits.2)Alicenseoffersperpetualuse,futureupdates,andremovespurchasereminders,enhancingproductivityandsupportingdevelopers.

Sublime Text: Enhancing Your Coding WorkflowSublime Text: Enhancing Your Coding WorkflowMay 08, 2025 am 12:19 AM

SublimeText can greatly improve work efficiency. 1) Multiple selection and multicursor functions allow editing of multiple positions at the same time, 2) Command panel provides fast function access, 3) Macros and fragments can automate common operations, 4) Optimized configuration and shortcut key use can improve performance and efficiency.

Sublime Text: Free to Try, Not Necessarily Free to OwnSublime Text: Free to Try, Not Necessarily Free to OwnMay 07, 2025 am 12:02 AM

SublimeText offers a free trial, but ultimately requires a paid purchase for a permanent authorization. 1) During the free trial period, users can experience its functions, but they will receive a purchase prompt. 2) After purchase, users can use it permanently, no subscription fee, and access more plug-ins and themes.

Sublime Text: Comparing Paid and Unpaid FeaturesSublime Text: Comparing Paid and Unpaid FeaturesMay 06, 2025 am 12:07 AM

ThemaindifferencesbetweenthepaidandunpaidversionsofSublimeTextaretheremovalofstatusbarremindersandoccasionalpop-uppromptsinthepaidversion.1)Unregisteredversion:fullyfunctionalwithallcorefeatureslikesyntaxhighlighting,codecompletion,andcommandpalette,

Sublime Text: The Cost of a Powerful EditorSublime Text: The Cost of a Powerful EditorMay 05, 2025 am 12:04 AM

SublimeText is worth buying. 1) Its simple interface and powerful functions, such as multi-line editing and GotoAnything, improve development efficiency. 2) Rich plug-in ecosystem, such as Anaconda, enhances the development experience. 3) Although the price is $70, its performance and fluency are great value for professional developers.

Sublime Text: Code Completion, Syntax Highlighting, and MoreSublime Text: Code Completion, Syntax Highlighting, and MoreMay 04, 2025 am 12:04 AM

SublimeText is loved by developers for its powerful code completion and syntax highlighting capabilities. 1) Code completion can automatically prompt function names, variable names, etc. to improve programming efficiency. 2) Syntax highlighting distinguishes code elements through different colors to improve readability and error detection speed.

Sublime Text vs. VS Code: A Comparative AnalysisSublime Text vs. VS Code: A Comparative AnalysisMay 03, 2025 am 12:07 AM

SublimeTextisidealforthosevaluingspeedandsimplicity,whileVSCodesuitsthoseneedingextensivefeaturesandcustomization.SublimeTextoffersquickfileaccesswith"GotoAnything"andaminimalisticapproach,butmaylackout-of-the-boxfunctionality.VSCodeprovide

Sublime Text: Your Coding CompanionSublime Text: Your Coding CompanionMay 02, 2025 am 12:01 AM

SublimeTextisapowerfulcodingcompanionduetoitsspeed,customization,andkeyfeatures.1)Itoffersincrediblespeedforhandlinglargefiles.2)Itsflexibilityallowsextensivecustomizationwithpluginsandthemes.3)Featureslikemultiplecursors,GotoAnything,CommandPalette,

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools