3

I've tried this and this with no success, in both cases when I C-c C-p I still get python2.7..

2 Answers 2

3

You have to change the python interpreter that emacs is using with the command

(setq python-shell-interpreter "python3")

you should set it to whatever the command is that you want. It can also be ipython in which case you would need

(setq python-shell-interpreter "ipython"
      python-shell-interpreter-args "-i")

where the ipython command calls the python 3.5 version of ipython

Sign up to request clarification or add additional context in comments.

Comments

2

The above solution did not work for me. What did work was:

(setq py-shell-name "python3")

According to py-choose-shell in python-mode.el, it chooses the shell via the following methods:

This does the following:

  • look for an interpreter with `py-choose-shell-by-shebang'
  • examine imports using `py--choose-shell-by-import'
  • look if Path/To/File indicates a Python version
  • if not successful, return default value of `py-shell-name'

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.