Sublime Forum

Execute Python

#1

I can’t execute anything from sublime. I always get this message;

‘python’ is not recognized as an internal or external command,
operable program or batch file.

I have looked up many tutorials and i do not have a path variable in my user variables to edit, nor do i have Python.sublime-build anywhere either. I have no idea what to do.

0 Likes

#2

Going from back to front on your questions:

Python.sublime-build isn’t in a visible location; the Python package ships as a pre-installed package in Sublime, and the pre-installed packages aren’t provided as loose files, they’re stored in sublime-package files (a renamed Zip file). You can use PackageResourceViewer to look inside the Python package and look at/modify the file.

Windows has a system path and a user path; the user path gets merged with the system path when you run things. So if you’ve never added anything to your user path, it may very well be empty or missing.

As you probably know, this is an error that’s indicating that windows can’t find an executable named python anywhere in order to run it.

If you haven’t installed python yet, you need to do that first; sublime includes it’s own internal version of python for its own use but you can’t use it to run your own python code using a build system. I think that the python installer should ask you if you want to add it to the path, which saves you a step. It’s been a long time since I installed it though, so I can’t remember for sure.

If you have installed python already, adding the folder location that the binary is stored in to your (potentially empty) user path is all you need. In order for it to work from sublime you need to be able to open a generic command prompt and be able to enter python and have it work.

0 Likes

#3

I didn’t have the option selected to add the path. I reinstalled it with the option and now everything works fine.
Thanks!

1 Like