1

I'm using python-mode 6.0.1 on OS X, emacs 23.3 (http://emacsformacosx.com/ version).

I'm trying to get C-c C-c to default to python 3.

I have the following in my .emacs:

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

And when I run C-h b py-python-command, it tells me the value is that (correctly).

However, running C-c C-c still opens 2.7.2.

I also tried adding:

(setq py-which-shell "/usr/local/bin/python3")

as suggested here: Both Python 2 and 3 in Emacs, but that doesn't change anything (py-which-shell does get changed, but it still launches 2.7.2).

Any ideas?

2 Answers 2

1

Try adding the following code to your Emacs init file:

(add-hook 'python-mode-hook
            (lambda ()
              (setq py-python-command "python3")
              (setq py-default-interpreter "python3")))
Sign up to request clarification or add additional context in comments.

Comments

0

py-default-interpreter for now is an alias only, delivered for backward compatibility

You might have encountered a bug.

Please file a report giving some example code at https://bugs.launchpad.net/python-mode

Should the buffer code contain a shebang specifying pythonVERSION , than this takes precedence over default setting.

You may enforce executing buffer through specific pythonVERSION by calling a command of class py-execute-buffer-pythonVERSION

See menu PyExec, entry Execute buffer ...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.