SublimeText3 is Building in Python 2 but I want to use Python 3. How do I Change Versions (Ubuntu 18.04)?

29 views Asked by At

I'm trying to get SublimeText3 to build with Python 3 on Ubuntu 18.04. I have python 3.6.6 installed on my Ubuntu machine, but Sublime is defaulting to Python 2 when I press ctrl+b. When I search with the "build with" option, no Python 3 option is available.

What do I have to do to get the option of using Python 3 in my SublimeText3 project builds?

1

There are 1 answers

1
Dekel On BEST ANSWER

Tools -> Build System -> New Build System

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

Save it with the name python3

Go to Tools -> Build system -> and check python3

Try to test it using:

import sys
print(sys.version)

Press: Ctrl + b

Source: https://gist.github.com/zaemiel/4fbd8b5125fda7a140be