개발의 'ㄱ'자라도 아는 날을 기대하며...

How to build Python3 on Sublime text 3 for Mac

Last updated over 3 years ago
2 0 1 0

It is officially announced that Python3 2.x will be suspended for support. Here’s how to install Python3 for Mac. If you already have Python3 in your system, start reading part 2.

1. Install Python 3

As you’ve probably know, Python is generally installed in Mac. If you want to know what version does your Mac have, here’s how you can find out:

$ python --version
Python 2.7.10

You can download 3.x version via the following link to Python officail website https://www.python.org/downloads/mac-osx/. Open pkg file to start the installation.

2. Register Python 3.X in build system on Sublime

If you open Python 3.x on Sublime after the installtion, you will still see that the program runs 2.7 instead of the new version you just downloaded. If you want to start 3.x version, you have to register Python 3 on your new Build System.

1) Find out where Python3 was installed on your terminal via using the following command:

$ which python3

Memorize or write down the location becuase you will need to input the loation in Sublime.

2) Click Tools > Build System > New Build System

Sublime3 Tools sub-menu
Sublime3 Tools sub-menu

3) With the new tab, input “untitled.sublime-build” and save

    "cmd": ["/Library/Frameworks/Python.framework/Versions/3.7/bin/python3", "-d", "$file"],
    "selector": "source.python",
    "file_regex": "^[ ]*File "(…*?)", line ([0–9]*)"

Input the location you found out on terminal in "cmd" and save with cmd+s. I recommend to name the file with something meaningful. I used python3.sublime-build as the file name.

FYI, the location of file on *.sublime-build is Users/{USER_NAME}/Library/Application Support/Sublime Text 3/Packages/User

4) If the file is properly saved, you will see the saved file on your Build System menu.

Python3 on Build System
Python3 on Build System

3. Python3 Build Test

Write short Python code on Sublime for the test and save iwth .py

import sys
print("Hello, python!")

Click Tools > Build System > pytho3 and save with cmd+b, you will see the result as below:

This is how it looks
This is how it looks

You don’t need to select .py afterwards.


안녕하세요?^^ 개발자라는 소리를 듣고 싶어 늦은 나이에 개발의 세계에 몸담게 된 Brad 라고 합니다. 아직 개발의 'ㄱ' 자도 모르지만, 개발을 배우면서 알게되는 것들을 림프에 정리해보려고 합니다. 저의 부족한 글이 누군가에게 조금이나마 도움이 되길 바랍니다.

Essedrop - Make your file online instantly


Leave a response to @brad

Please sign in to comment.
Markdown is also available in comment.