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.