Elpy: Making python3 default

Created on 14 Sep 2016  路  5Comments  路  Source: jorgenschaefer/elpy

I have made python3 the default version for my system (i have put alias python=python3 in ~/.bashrc file). Now when i run python in terminal i get python 3.4.2, but starting the interpreter for elpy runs still python2. How can i change it to be python3 there too?

Question

Most helpful comment

There are different variables. The elpy-rpc-python-command is for the interpreter that the RPC backend will use (Elpy) and then what shell you want to run which is python-shell-interpreter.

So all together it should look like this in your init.el

;; For elpy
(setq elpy-rpc-python-command "python3")
;; For interactive shell
(setq python-shell-interpreter "python3")

All 5 comments

You can set the python version by

(setq elpy-rpc-python-command "python3")

I suppose i should put it in my init.el? But doing C-c C-z still trigger the 2.7.9. What am i doing wrong?

Here some info, RPC is already 3 but the interactive not:

Elpy Configuration

Virtualenv........: None
RPC Python........: 3.4.2 (/usr/bin/python3)
Interactive Python: python (/usr/bin/python)
Emacs.............: 24.4.1
Elpy..............: 1.12.0
Jedi..............: Not found (0.9.0 available)
Rope..............: Not found (0.10.3 available)
Importmagic.......: Not found (0.1.7 available)
Autopep8..........: Not found (1.2.4 available)
Yapf..............: Not found (0.11.1 available)
Syntax checker....: Not found (pyflakes)

There are different variables. The elpy-rpc-python-command is for the interpreter that the RPC backend will use (Elpy) and then what shell you want to run which is python-shell-interpreter.

So all together it should look like this in your init.el

;; For elpy
(setq elpy-rpc-python-command "python3")
;; For interactive shell
(setq python-shell-interpreter "python3")

Did that solve the question you had?

Closing since no updates

Was this page helpful?
0 / 5 - 0 ratings