Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Activating a pyenv virtual environment with direnv

$
0
0

I use both direnv and pyenv and would like to add something to my .envrc so that whenever I change directory, I also activate my virtual environment with pyenv.

I printed environment variables both when my virtualenv is active and also when it is not. There were a few pyenv variables set, which I added to my .envrc (see below). I was hoping these would activate my pyenv virtual environment upon changing to the directory, but it didn't work.

I'll keep poking at this and trying to sort it out. If I find the answer, I'll update the question with the answer. In the meantime, I'm curious if anyone else has configured direnv so that a virtual environment is loaded upon cd'ing to a directory. If so, would you mind sharing how you did it?

** DID NOT WORK WHEN ADDED TO .envrc**

PYENV_VERSION=dsPYENV_ACTIVATE_SHELL=1PYENV_VIRTUAL_ENV=/Users/evan/.pyenv/versions/3.10.4/envs/dsVIRTUAL_ENV=/Users/evan/.pyenv/versions/3.10.4/envs/ds

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>