DEV Community

Discussion on: How do YOU manage python environments

Collapse
 
reritom profile image
Tomas Sheers

I use Conda. Whenever I start a new project, I create a new directory, cd into the directory, and then run a custom bash function called 'new' which creates a new Python 3.8 Conda environment with the name of the directory, activates it, and installs any requirements if the requirements.txt already exists.

I also had a function for cd which would activate environment when cd-ing into a directory if there was an environment with the name of the directory. But in some cases I didn't want that to happen, so I stopped using that. Instead I have an alias of 'activate' which will activate the correct Conda env.

Collapse
 
waylonwalker profile image
Waylon Walker

I like the idea of the auto-activation, but can see where it could cause some frustrations as well. I made a fuzzy condo environment activator with fzf to make it a bit less verbose.

a () {
     source activate "$(conda info --envs | fzf | awk '{print $1}')"
     }