Search code examples
pythonemacsvirtualenvemacs-prelude

How to setup Emacs to use a given Python virtualenv?


I use Emacs for a number of tasks and as I am starting to work with Python I would like to keep using Emacs to code in Python.

I have set up a virtualenv for Python3, and it is working as desired. I also have Emacs 24.5 installed with the latest version of Emacs Prelude.

When I edit an Python source file all I expected is working -- code completion, object inspection, etc. -- but for my system wide Python installation, not for the virtual environment I have set up for the project.

How can I tell Emacs to use the virtual environment for a given project?


Solution

  • I know this is quite an old thread, but for those who come here looking for answer, more up to date answer might be useful.

    I use pyvenv, mainly pyvenv-workon.

    Give it a try. I hope it works for you.