11

Questions like this: Change python interpreter - Sublime Text 2 are great for if you actually want to run Build against your Python code. However, I want plugins (such as SublimeRope) to run the Python of my choosing rather than the built-in Python, which happens to be 2.6

I work in Python 2.7, so the built-in Python 2.6 causes syntax errors to be raised often when trying to use SublimeRope.

I've found all sorts of ways to change the Python related to running code being worked on, but none that affect the Python used by the plugin.

I've been using:

import sys
print sys.version

in the plugin .py code to see what version is being run against it, and it's always the built-in 2.6

EDIT 1: I see there is a feature request into Sublime Text 2 to make Python 2.7 the embedded python: http://sublimetext.userecho.com/topic/105249-update-the-python-embedded-interpreter-to-27/ Please upvote that if there is no other way to do this.

EDIT 2: This issue for the plugin SublimeLinter is relevant: https://github.com/SublimeLinter/SublimeLinter/issues/13 Because of how that plugin is setup, it appears to be possible to use the system Python instead of the Sublime Text 2 embedded Python. I haven't been able to find an analogous way to change the Python used for the SublimeRope plugin.

Community
  • 1
  • 1
Bodhi
  • 1,437
  • 1
  • 13
  • 21
  • The SublimeJEDI project https://github.com/svaiter/SublimeJEDI is another plugin for autocompletion in Python, and has functions to pickup the right python for your project in order to parse the syntax correctly and not break on "syntax errors" coming from using the wrong Python. But it's not fully functional yet (I've used it in Vim before) – Bodhi Jan 22 '13 at 20:30
  • possible duplicate of [Change python interpreter - Sublime Text 2](http://stackoverflow.com/questions/11313131/change-python-interpreter-sublime-text-2) – user Sep 23 '13 at 12:12

1 Answers1

2

I have solved this by creating a custom build system.

this is for example what I am using:

{
    "cmd": ["/Library/Frameworks/Python.framework/Versions/Current/bin/python", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}
m3o
  • 3,881
  • 3
  • 35
  • 56