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.
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
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.
3. Then go to Preferences > Package Control > Package Control: Install Package.
4. In textbox type SublimeREPL and select it to install the plugin. After installation restart sublime text.
5. Now got to Tools > Build System > New Build System. A new file will open, just paste the following code in it.
{ "target": "run_existing_window_command", "id": "repl_python_run", "file": "config/Python/Main.sublime-menu" }
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.
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.
how to setup sublime text to run python on mac?
You noob for life mate. UNINSTALL YER LIFE
ok
lol
LMAO
I am facing problem running numpy,panda,matplotlib on my sublime text3.
Though no problem with normal python program
Hey! Your tutorials are awesome.
i have my python script and set up the full thing
but i still don’t understand
where does the output come???
yeah same here, when i click build, i got nothing. have you found a solution?
This was so helpful, thank you for putting this together.
5/5 stars
OW, it helps. Thanks a lot.
Thanks!
File not foundError(2,’The system cannot find the file specified.’ none,2)
ME TOO! please admin why this happen
Me too, please help
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.
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
yes same with me. why does it happen though?
after doing whole process i m facing a problem
a pop box says
the system cannot find the file specified
Thanks bro…
how to configure git in sublime
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.
I have tried the above method and can’t get any Python to run in Sublime Text 3.
Just press Ctrl+B
thank you