Build Python IDE with Sublime Text3 on Mac OS X

It is totally a different and refreshing experience to code within Sublime Text, compared with shell, terminal of MAC and even PyCharm. The flexibility of packages enables users to change the code interface and environment as preferences, and some of the packages can even improve the efficiency of programming.

Screen Shot 2017-03-07 at 2.37.18 PM

Steps:

  1. First install Sublime Text3
  2. Install Python. I am using python 3 the latest version since 3 is the future and the difference between 3 and 2 are not that significant. Python 3 syntax is even a little like R, which I like a lot.
  3. Go to terminal, type “which python”

Screen Shot 2017-03-07 at 2.50.14 PM

/Library/Frameworks/Python.framework/Versions/2.7

I already installed 2.7.

I strongly recommend to install different packages of python of both 2.7 and 3.6. You can user command line in terminal to decide which one you want to conduct.

If you go the same folder, you would the the path of Python which you just installed;

or we can do it like this typing “which python3”:

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3

Screen Shot 2017-03-07 at 2.53.19 PM.png

Copy and save this path .

4. Go to Tools -> Build System -> New Build System

Screen Shot 2017-03-07 at 2.55.37 PM.png

5.  In this window, input the following code to ensure you have the saved path entered.

Screen Shot 2017-03-07 at 2.59.06 PM.png{
    "cmd": ["/Library/Frameworks/Python.framework/Versions/3.6/bin/python3", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

6. Save the file with a name like Python3.6.sublime-build. Go back to build system you should be able to see the system with the name you just picked.

7. Check. Type

print(“Hello”)

and save it as .py file, and then command+B or control+R to run.

8. Two essential packages.

Command+Shift+P, enter “Install Package”, and then enter”Anaconda” and enter to install. Do the same with “SublimeCodeIntel” package.

You can go to Sublime Text-> preferences -> package Settings to the installed packages and adjust settings.

Anaconda package came with a lot of setting adjusted for Mac users already.

9. To install modules for python like pandas or numpy, use pip3 install XXX command in terminal, NOT pip.

NOW YOU R READY TO ROLL.

Advertisements

1 thought on “Build Python IDE with Sublime Text3 on Mac OS X”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s