Search code examples
pythonemacsjedi

setting emacs jedi to use python 3 by default


is there a way to let emacs know that i want to use python3 instead of python2?

already tried

(setq jedi:environment-root "jedi")  ; or any other name you like
(setq jedi:environment-virtualenv
      (append python-environment-virtualenv
              '("--python" "../../usr/bin/python3")))

and emacs keeps saying

Debugger entered--Lisp error: (void-variable python-environment-virtualenv)
  (append python-environment-virtualenv (quote ("--python" "/usr/bin/python3")))
  (setq jedi:environment-virtualenv (append python-environment-virtualenv (quote ...)))
  eval-buffer(#<buffer  *load*> nil "/home/abdul/.emacs" nil t)  ; Reading at buffer position$
  load-with-code-conversion("/home/abdul/.emacs" "/home/abdul/.emacs" t t)
  load("~/.emacs" t t)
  #[nil "^H\205\264^@   \306=\203^Q^@\307^H\310Q\2027^@ \311=\2033^@\312\307\313\314#\203#^@\$
  command-line()
  normal-top-level()

Solution

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

    make sure is there this name "python3" in /usr/bin/
    add it to your .emacs and M-x eval-buffer.