Last Updated: December 01, 2017
· hckmar
Fotor 142414745635266

Setting up SublimeREPL with Python3

Hi again, in personal I like to use the console of sublime text for interact with Python, but my recent projects has been made with Python3 version, I've been through lot of stress, so I didn't remember how change to the Py3 version on SublimeREPL (the console mode), could sound dummy for someone. Well I couldn't find a quick answer, so after a nice shower and a good latte, this was my solution, that I share with you! (thanks to an old and nerdy buddy)...

First I use ubuntu 14.04, so already have Python 2.7 and 3.4.
I use Sublime Text 3 like an editor, with SublimeREPL for console mode.
At this point, SublimeREPL has as default the version 2.7, this is wat I want to change for the 3.4 v.

I need to go in my Sublime Text editor to: Tools->Build System->New Build System and put the next lines:

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

Then save it with a meaningful name like: python3.sublime-build (the extension for the building).

The last step to do is go to edit the Main.sublime-menu file, it's located: ~/.config/sublime-text-3/Packages/SublimeREPL/config/Python

Here you just need to put the number of the version 3 in some order, but I leave the example of my final file in a gist so you can check it:

And that's all! so simple I know but helps! Greetings.

Say Thanks

2 Responses
Add your response


Thank u very much,It works.

over 1 year ago ·

Thank you :)

2 months ago ·
Filed Under