Sunday, May 5, 2019

Emacs as Python3 IDE in Mac

Install the following using your preferred method:

pip3 install rope jedi importmagic autopep8 flake8

In Emacs:

M-x package-install RET elpy RET
M-x package-install RET exec-path-from-shell RET
M-x package-install RET pyenv RET
M-x package-install RET anaconda-mode RET

Edit .emacs as following:

(elpy-enable)
(when (memq window-system '(mac ns x))
    (exec-path-from-shell-initialize))
(add-hook 'python-mode-hook 'anaconda-mode)
(setenv "WORKON_HOME" "/anaconda3/envs")
(pyvenv-mode 1)

Restart your emacs and enjoy using the best Python IDE

Use M-x pyvenv-workon to switch between anaconda environments