Sublime Forum

How do I tell Sublime which version of Python to use?

#1

Hi,

Running sublime on Ubuntu which ships with 2.7 and 3.5 pre installed. How do I tell Sublime which version of Python to run my code with? I think its running it with 2.7 because its saying modules i installed for Python 3.5 are missing

Thanks

0 Likes

#2

The default Python build system currently runs this:

    "shell_cmd": "python -u \"$file\"",

So, probably python 2.7 if python 3.5’s interpreter is named python3.

In order to change that you need to create your own build system or override the default python build system.

If you don’t already have it installed, I recommend PackageResourceViewer. You can use it to open the Python.sublime-build file from the Python package and modify the shell command to use the appropriate interpreter.

The default build system also includes a variant for syntax checking which you should probably also update so as to save yourself potential headaches in the future.

0 Likes