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
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
Comments
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'