2

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

agf
  • 171,228
  • 44
  • 289
  • 238
Georgina
  • 381
  • 1
  • 6
  • 13

3 Answers3

1

See a previous discussion on this

In your .emacs file, following should do:

;; python 3
(setq python-python-command "python3")
Community
  • 1
  • 1
pyfunc
  • 65,343
  • 15
  • 148
  • 136
  • But I don't want to use both versions--just version 3.1 . Thanks for the link, though! – Georgina Nov 29 '10 at 00:48
  • Hmmm. Thanks for trying, but that doesn't seem to work. Tried it with both 'python3' and 'python3.1'--when I load a .py file in Emacs it says 'Using cpython shell'. Does that help? – Georgina Nov 29 '10 at 01:07
1

All I had to do was add

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

To my .emacs file.

Georgina
  • 381
  • 1
  • 6
  • 13
0

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")))
zev
  • 3,480
  • 18
  • 13