Set Up Sublime Text 3 to use Python 3

Set Up Sublime Text 3 to use Python 3

This is writing is here to help you set up your simple IDE for code using Python 3 on your computer especially on UNIX environment ?

Step 1: Make sure you already have Python 3xx on your computer!

$ python3 –versionPython 3.7.1

Make sure you use python3 to check your Python3 version ??

If your computer says that you don?t have Python3, you can download it from the Python website and installed it on your computer.

Step 2: Make sure you already have Sublime Text on your computer!

At the time of this writing, the latest sublime is Sublime Text 3 you can download it from and install it right away

Image for postSublime Text 3

Step 3: Let?s setting Python3 on your Sublime Text

Create a new file and save it with extension .py for example save it as

Go to Tools -> Build System -> Python then type on your

import sysprint(sys.version)

then press CTRL + B to run the code on Sublime

Image for postExample check version on Sublime Text 3

As you see, the version on the sublime is Python 2.7 we need to use Python 3. Then we can set the Sublime Text to use Python3 instead of Python2. Here?s the step:

First: Check where is your Python3 path using this command


$ which python3/usr/local/bin/python3


C:Users<users>pyPython 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32Type “help”, “copyright”, “credits” or “license” for more information.>>> import os>>> import sys>>> os.path.dirname(sys.executable)’C:\Users\<user>\AppData\Local\Programs\Python\Python37-32′

Second: Add new build system on your Sublime

Tools -> Build System -> New Build System and make sure that the new build system has this following command


{ “cmd”: [“/usr/local/bin/python3”, “-u”, “$file”], “file_regex”: “^[ ]File “(…?)”, line ([0-9]*)”, “selector”: “source.python”}


{ “cmd”:[“C:/Users/<user>/AppData/Local/Programs/Python/Python37-32/python.exe”, “-u”, “$file”], “file_regex”: “^[ ]File “(…?)”, line ([0-9]*)”, “selector”: “source.python”}

and save this file as newPython3.sublime-build

Third: Select your new system build newPython3 and re-run the and now it should be using Python 3

Image for post

Now you can use Python3 on your Sublime Text! Happy coding ?


No Responses

Write a response