Sublime Forum

Using py instead of python for build

#1

I prefer to use py, (the python launcher) rather than python as it makes it easy to select the appropriate version of python, I struggled a little bit but here is what worked for me (Sublime 3 on Windows only)

First I wanted to see what the built in Python.sublime-build settings looked like, to do this I unzipped the existing package file from the Sublime packages folder, somewhere like C:\Program Files\Sublime Text 3\Packages, this step is tricky as it is not obvious the package files are in fact zip files.

In the zip file look for Python.sublime-build, to save you some time it looks like:

{ "shell_cmd": "python -u \"$file\"", "file_regex": "^ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python" }

To tweak this, change the shell_cmd value to replace “python” with “py” then save the result in

%APPDATA%\Sublime Text 3\Packages\Python\Python.sublime-build

(note, %APPDATA% is an environment variable, and will be something like C:\Users\USERNAME\AppData\Roaming)

1 Like