Sublime Text 3, adding a custom python 3 build

Typing ‘python’ at the command line of my Linux Mint 18 install gives me a python 2.7 prompt. So when I run a python script in Sublime Text, it was built using Python 2.7. But I want to use python 3! So I entered a custom python 3 build.

I use Linux Mint 18. The “shell_cmd” mentioned below will be different for Windows and maybe for Mac OS as well.

To create a build option in Sublime Text 3 for your favorite version of Python, create a file called:


Where sublime_install is the path to the directory where you have sublime installed.

The file should contain this text:

    "shell_cmd": "/usr/bin/env python3 -u ${file}",
    "selector": "source.python",
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "working_dir": "${file_path}",

You may need to change ‘python3’ to whichever command prompt fires up the version of python you want to run.

The option ‘Python3’ will now appear in your build menu on Sublime Text 3.

The -u option in the “shell_cmd” removes buffering. I missed this out initially, leading to some head scratching.  My scripts would run, but I wouldn’t see any output for some time – until the output buffer had filled. Luckily  Stackoverflow came to my help:

Leave a Reply

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