How to Run Python Program in Sublime Text

In this tutorial you will learn how to run python program in sublime text in windows.

Just follow below steps to configure sublime text. The whole process is divided into two parts.

Part 1: Setting Path

First of all you have to set the path of python installation directory in environment variable. You can skip this step if it is already done.

1. Copy the path of python installation directory. In my case it looks like as shown below.

C:\Users\TCP\AppData\Local\Programs\Python\Python36-32

Note: Here TCP is the user name of my computer. It will be different in your case.

2. Now right click on Computer and click on Properties option. Then select Advance system settings in left sidebar.

3. Now click on Environment Variables and then under System variables select variable with name Path.

4. Click Edit button and then in Variable value field go to end and type semicolon and then paste the path of python directory that you copied. See below screenshot.

How to Run Python Program in Sublime Text 1

5. Finally click on all OK buttons to save the settings.

Part 2: Install SublimeREPL Plugin

For taking input from user in sublime text we need a plugin named as SublimeREPL. So follow below steps to install it.

1. Go to below link and copy the code according to your sublime text version.

https://packagecontrol.io/installation

How to Run Python Program in Sublime Text 2

2. Open sublime and go to View > Show Console. Then in console box at bottom paste the code that you have just copied and press enter. Wait for few seconds, it will install required packages.

How to Run Python Program in Sublime Text 3

3. Then go to Preferences > Package Control > Package Control: Install Package.

How to Run Python Program in Sublime Text 4

4. In textbox type SublimeREPL and select it to install the plugin. After installation restart sublime text.

How to Run Python Program in Sublime Text 5

5. Now got to Tools > Build System > New Build System. A new file will open, just paste the following code in it.

6. Press ctrl + s and save it with file name Python_RUN.

7. Go to Tools > Build System and select Python_RUN as build system or you can use ctrl + b as shortcut.

How to Run Python Program in Sublime Text 6

8. For running a python program go to Tools > Build.

Video Tutorial

Comment below if you are facing any problem to run python program in sublime text.

Leave a Reply

Your email address will not be published. Required fields are marked *