Search code examples
anacondavirtualenvminiconda

How to associate a conda enviroment with a project directory


I have been using miniconda for a while and have set up conda environments for each for each of my projects. What I can't figure out after looking through the documentation, is there a way to bond/associate my conda environment to my project folder for that conda environment? So that when I activate a specific conda environment it moves directly into the associated project directory. This virtualenvwrapper etc. can do for example. Is conda able to this?


Solution

  • As mentioned in Activating an environment, conda automatically executes "activation scripts" when an environment is activated. These scripts are typically provided by conda packages installed in the environment.

    Just add a script of your own with a cd command. See here for details:
    https://stackoverflow.com/a/43415167/11451509