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.

25 thoughts on “How to Run Python Program in Sublime Text”

  1. I am facing problem running numpy,panda,matplotlib on my sublime text3.
    Though no problem with normal python program

        1. You can fix this problem by these following step
          go to the Preferences -> Package Settings -> SublimeREPL -> Settings – User
          if you’re running portable python, then paste it
          {

          “default_extend_env”: {“PATH”: “{PATH}:\\Programming\\Python\\Portable Python 2.7.6.1\\App\\”}

          }
          otherwise
          {
          “default_extend_env”: {“PATH”:”{
          “default_extend_env”: {“PATH”:”C:\\Users\\Code_Marshal\\AppData\\Local\\Programs\\Python\\Python38-32\\”},
          then save it.

  2. Abhishek Sharma

    I keep getting this error when i try to build the python program.

    C:\Users\Abhi\AppData\Local\Programs\Python\Python37-32\python.EXE: can’t open file ‘$file_basename’: [Errno 2] No such file or directory
    Kindly help

  3. after doing whole process i m facing a problem
    a pop box says
    the system cannot find the file specified

  4. hey dear
    after complete these steps , I run my python tkinter program I’ve got a blank screen with title . so what can i do ???? please help.

Leave a Comment

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