Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change default python version EMACS 23 uses?

Tags:

python

emacs

Trying to change the version of python emacs uses. (OSX10.6)

In Terminal python brings up the version I've set up in PATH But in EMACS it does not.

How can I change this?

like image 655
a.m. Avatar asked May 10 '11 15:05

a.m.


People also ask

How do I change Python version on Mac?

To change the default version on a MacOS, we can begin by downloading the newest installer from the Python downloads page (https://www.python.org/downloads/mac-osx/). Downloading the installer will insert the new version into /usr/local/bin.


3 Answers

Another option is to look into fixing the environment variable PATH for Emacs which is a little tricky when using Emacs on Mac OS. Just make sure that Emacs' PATH has the same value as PATH in Terminal.app/Bash. These links should help:

Accessing OS X / UNIX environment variables in Emacs minibuffer

http://www.emacswiki.org/emacs/EmacsApp

(cf. Section "Path" and "Alternative Path Solution")

like image 97
fgeller Avatar answered Sep 19 '22 11:09

fgeller


The easiest way (assuming you are running the GUI version of Emacs), is to choose

Options->Customize Emacs->Specific Option

and type python-python-command, and fill in the path to the python you want. Then save for future sessions and you should be good.

I'm really not sure why it wouldn't be honoring the path variable. The default should be simply "python" (no path). Maybe you have already set this, or you are changing the command path in your .emacs? You could look in ~/.emacs and see if you are doing either of those.

like image 37
andrewdski Avatar answered Sep 19 '22 11:09

andrewdski


try to add this to your .emacs or other config file:

(setq python-version-checked t)
(setq python-python-command "python2.7")
like image 42
Richard Huang Avatar answered Sep 21 '22 11:09

Richard Huang