Closed nayefc closed 8 years ago
I think you've perhaps misunderstood what this package does.
exec-path-from-shell-copy-env
fires up a fresh shell, and asks it to print out the desired env vars. Inside that fresh shell, any virtualenv settings you made inside Emacs will not be visible, and so the $PYTHONPATH
in Emacs will not change.
I'm not sure why pyenv-mode
alone would be insufficient. Perhaps @proofit404 can comment?
pyenv-mode
does not copy environment variables for some reason.
I have a hacky solution, which is to edit pyenv-mode.el and add call setenv
whenever a new virtualenv is being activated. I thought exec-path-from-shell would be able to fix this in a less hacky way.
Don't forget that environment variables are Emacs-wide, so changes will affect every buffer. I presume that pyenv-mode
is designed such that it is not necessary to modify them.
Yeah I think that's fine for me as I rarely have multiple buffers that span multiple Python projects. I don't think pyenv-mode
takes PYTHONPATH
into account, which is used pretty often for packaging related needs (python packaging is terrible).
First of all pyenv-mode deal with pyenv project alone not with pyenv-virtualenv plugin. So processing activation scripts is out of the package goal. I can add customizable hooks running after set or unset python versions. You'll be able to try to get PYTHONPATH with in this hook. But you need to activate you virtual environment in the shell running by exec-path-from-shell-copy-env
.
Hello,
I have a
$PYTHONPATH
being set when a Python virtualenv is being activated. When I activate the virtualenv in Emacs usingpyenv-mode
, I am callingexec-path-from-shell-copy-env
to copy the variable, but it isn't getting copied. Is there anything else that I will need to do, to get it to work with virtualenvs? Has anyone had any success using this package with virtualenvs?