So, one thing you may not be aware of is that
print("Hello World")
is valid in both Python 3 and later revisions of Python 2, including 2.7.6, so if you're running your file from the command line, it'll execute properly regardless of which interpreter you're using.
You may also be confusing yourself regarding the Console in Sublime and the build systems. The Console, opened by hitting Ctrl` or selecting View -> Show Console
, is running Sublime's internal version of Python, a stripped-down Python 3.3.3 if you're using the latest build. You cannot run Py2 commands in the console, no matter how hard you try. It is useful for running Python API commands to control Sublime itself, but it's of no use in building non-plugin files.
Build Systems let you run your programs through external compilers, interpreters, processors, or what have you. They are activated by choosing one in the Tools -> Build System
menu, and then hitting CtrlB (or CommandB on OS X) to run it.
So, to verify that your build systems are working as desired, create a new .py
file with
print "Hello World"
in it. Save the file, and select Tools -> Build System -> Python
(the first one in the menu, between Make
and Ruby
). Hit CtrlB or CommandB as appropriate for your OS, and check out the pane that opens at the bottom of Sublime. It should show "Hello World" at the top line, then another line saying [Finished in 0.05 seconds]
or something similar underneath it.
Now, select Tools -> Build System -> Python 3
(or whatever you named your new build system) and hit Ctrl/CommandB, and you should now see a traceback in the build pane for invalid syntax.