I am able to set python3.2 for the build command in sublime text 2(and build with python3.2), but when invoking the console with cmd-` the interpreter is mac's default 2.6 version. Any help is greatly appreciated!
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Django __str__ returned non-string (type NoneType)
- Evil ctypes hack in python
What you're seeing is the Python that comes bundled with Sublime Text. I wouldn't upgrade it, but if you want to use your own you could do something like:
Cmd+` is supposed to open Sublime Text's embedded interpreter console, i.e. the one that you use when developing or debugging Sublime plug-ins. You can verify that by noticing that the
sublime
module is available.If you really want Python 3 console there, upgrade to Sublime Text 3 which embeds Python 3.3. Alternatively, use a dedicated plug-in like SublimeREPL (see @MattDMo's answer).
And BTW: If you want a nice environment for interactive Python work, I suggest to disregard the above and give IPython Notebook a shot.
The console in Sublime Text 2 uses the internal version of Python, which is 2.6. There is no way to change it without breaking a whole bunch of stuff. There is a workaround, though. If you just want a Python console within ST2, use the awesome SublimeREPL package, which can also be installed through Package Control. Among many other things, you can send selections or whole files to be interpreted through a REPL of your choice, including Python 3. Create
Packages/User/SublimeREPL/config/Python/Main.sublime-menu
with the following contents:changing the
"cmd"
option to the full path to yourpython3
binary. This way your changes will survive any SublimeREPL upgrades. BTW, this path works for any package, so you can feel free to customize away without fear of accidentally losing it all.You could try setting the environment variables something similar to the following in Tools > Build System > New Build System