pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

Is there a way to set environment variables for each version?

Open RobRoseKnows opened this issue 7 years ago • 1 comments

I'd like to be able to set environment variables specific to each virtualenv created by pyenv when I enter a directory. I found Issue #55 that seems to mention this and says it's not currently supported, but it's also from 2014, so I was wondering if anything has changed since then.

I tried adding export statements to ~/.pyenv/versions/3.6.5/envs/my-env/bin/activate (where my-env is a local 3.6.5 virtualenv set in the .python-version file) but they didn't get set. I'm planning on trying direnv as suggested in issue #55, but I was wondering if pyenv now has native support for this, or if such support is planned in the future.

RobRoseKnows avatar May 12 '18 17:05 RobRoseKnows

Came across this post in another git issue earlier today ... it has some code that is specific to miniconda, but it seems it could work in any situation. pyenv.d hook scripts: https://github.com/pyenv/pyenv-virtualenv/issues/178#issuecomment-387862525 ( Hope that helps @RobRoseKnows ) !

bossjones avatar Oct 27 '18 15:10 bossjones