Sublime Text : How to change the version of Python that Sublime Text uses for executing the code

This post describes the process to change the version of python that Sublime Text shall use for executing the code that your build by pressing Ctrl+B

Short Version :

in the sublime text window, go to Preferences > Browse Packages » Python and edit the path for python source in Python.sublime-build file

Detailed Version :

Open the “packages" folder for the installed Sublime Text by going to Preferences > Browse Packages as shown in the image below

In the directory that thus opens go to the Python folder and open the Python.sublime-build file for editing.

Update the contents of this file to something like below.

    //”cmd”: [“python”, “-u”, “$file”],

    //Python 3
    “cmd”: [“/usr/bin/python3”, “-u”, “$file”],

    “file_regex”: “^[ ]*File "(…*?)", line ([0-9]*)”,
    “selector”: “source.python”

Now you can comment out the undesired python version that you don’t need and re-enable them later.

Hope this helps