I'm trying to locate the Python interpreter that Sublime Text uses to run plugins.
Thinking that sys.executable
would give me an absolute path to a Python interpreter, I tried creating this plugin:
from sys import version_info, executable
from sublime_plugin import TextCommand
class GetPythonInfo(TextCommand):
def run(self, edit):
print(executable)
print(version_info)
Output in Sublime console:
>>> view.run_command('get_python_info')
python3
sys.version_info(major=3, minor=3, micro=3, releaselevel='final', serial=0)
Since I don't have Python 3.3.3 installed elsewhere on my system, I assume that this interpreter was installed as part of Sublime somewhere. Is there a way to run this interpreter outside of Sublime, and if so, how?
There have been some questions (like this one) asking how to change the Python interpreter for the purposes of the build system. By contrast, I want to build a virtualenv specifically for Sublime plugin development. Ideally, this virtualenv would be based on the Python 3.3.3 interpreter that Sublime uses internally.
I'm using Sublime Text 3 on Mac OS X, but I'd be interested in answers for other systems/versions of Sublime.