Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change python interpreter - Sublime Text 2

Tags:

sublimetext2

I just started using Sublime Text 2 and was wondering, to sort of make it a full featured python IDE, if there was a way to change the integrated python interpreter to target the system python install rather than the one that came with Sublime. The reason is because I would like to use my python libraries that I have on my computer with the python interpreter.

I am aware of running python code in sublime using my version of python as explicitly shown here: How do I run Python code from Sublime Text 2?

However, this does not change the version of the python interpreter that you are running.

Any ideas?

like image 446
tabchas Avatar asked Jul 03 '12 14:07

tabchas


People also ask

How do I configure Python interpreter in Sublime Text?

For language specific settings, click Sublime Text > Preferences > Settings - More > Syntax Specific - User. Then save the file using the following format: LANGUAGE. sublime-settings. For Python-specific settings, save the file as Python.

How do I change Python default interpreter?

Set Default interpreter path in settings; Select "Python: choose interpreter" in command pallete; Check choosed interpreter. It should be Default, but choosed is Recommended.

What version of Python does Sublime Text use?

Python Version By default all plugins are run using Python 3.3. 6, except inside the User package which always uses the latest python. Sublime Text's build of Python 3.3.


2 Answers

Tools > Build System > New Build System. Insert the file and with your python version:

{
  "cmd": ["python3", "-u", "$file"],
  "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
  "selector": "source.python"
}
like image 139
Davoud Taghawi-Nejad Avatar answered Oct 20 '22 10:10

Davoud Taghawi-Nejad


According to the documentation referenced by the Sublime Text website itself, the embedded Python intrepreter is not intended for general development. This restricted usage recommendation even applies to ST2 for OS X, which is the only version that does use the system's Python version. So it's probably better to use the Build System workflow, or use a ST plug-in. Or switch to a purpose-built IDE.

like image 44
reg360 Avatar answered Oct 20 '22 08:10

reg360