Georgina
Georgina

Reputation: 391

Update version of Python in Emacs 22.2.1

I've recently install Python 3.1, but Emacs still uses 2.6.5. I'm using Emacs version 22.2.1. I'm not sure which files to edit in order to make Emacs use Python 3.1 by default!

I'm using python-mode.el and pyemacs, if that helps...

Best, Georgina

Upvotes: 2

Views: 537

Answers (3)

zev
zev

Reputation: 3590

There are actually a number of different variables that need to be changed if you want to "globally" change the version of Python that is being used in python-mode. Try the following:

(add-hook 'python-mode-hook
            (lambda ()
              (setq py-python-command "/usr/bin/python3.1")
              (setq py-default-interpreter "/usr/bin/python3.1")))

Upvotes: 0

Georgina
Georgina

Reputation: 391

All I had to do was add

(setq py-python-command "/usr/bin/python3.1")

To my .emacs file.

Upvotes: 1

pyfunc
pyfunc

Reputation: 66709

See a previous discussion on this

In your .emacs file, following should do:

;; python 3
(setq python-python-command "python3")

Upvotes: 1

Related Questions