0

I'm using Projectile and pyenv-mode (https://github.com/proofit404/pyenv-mode).

pyenv-mode has projectile integration to update the virtual environment while switching projects. This is the code to do so:

(defun projectile-pyenv-mode-set ()
  "Set pyenv version matching project name.
Version must be already installed."
  (pyenv-mode-set (projectile-project-name)))

(add-hook 'projectile-switch-project-hook 'projectile-pyenv-mode-set)

I've enabled this code in my init.el. I'm not sure if or how this is supposed to integrate with shells (ansi-term and shell specifically), but I am trying to achieve the following:

  • When switching to a new project
    • switch any open shell buffers to the new python venv (can clear the buffer if required)
    • ensure than any wheel buffers opened while in a project also activate with that virtual env

What actually happens is that I get my default system Python in these shells at all times, unless I manually activate a virtual environment from in one of them.

3
  • In what way is it not working for you at the moment? Try using a shell and tell us what breaks! Apr 21, 2015 at 15:18
  • I'll add this to the question, but the answer to your comment is that any shell has the system python, and not the virtualenv of the currently active project.
    – pwalsh
    Apr 21, 2015 at 16:06
  • The problem is that (pyenv-mode-set) doesn't set the path, so in a shell you will always get the system version. I don't use pyenv nor projectile, but I did look at the (pyenv-mode-set) code here: github.com/proofit404/pyenv-mode/blob/master/…
    – xmonk
    Apr 21, 2015 at 19:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.