Can I choose where my conda environment is stored?

前端 未结 3 491
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 04:17

Can I change the path /Users/nolan/miniconda/envs/ to another one when creating a virtual environment ? I\'d like it to be specific to my project directory. (As we can do wi

相关标签:
3条回答
  • 2020-12-13 04:35

    conda create -p env-dir is the possible solution which i used where venv, virtualenv and even pipenv failed as I used berrycomda on my raspberrypi

    0 讨论(0)
  • 2020-12-13 04:43

    You can change the environments directory by editing your .condarc file found in your user directory. Add the following specifying the path to the directory you want:

    envs_dirs:
      - /Users/nolan/newpath
    
    0 讨论(0)
  • 2020-12-13 04:46

    If you would like it to be relative to your project directory, use the --prefix flag: https://conda.io/docs/commands/env/conda-env-create.html?highlight=prefix

    For example, if you use environment.yml files to define your environment and you want your environment to be created in the venv directory of your project you would use the following:

    conda env create -f environment.yml --prefix venv

    The conda create command also has the --prefix flag as well: https://conda.io/docs/commands/conda-create.html?highlight=prefix

    I don't know if this was available as of the original posting, but it should be available as of Liu Sha's comment, and gets closer to answering the question in regards to "I'd like it to be specific to my project directory".

    0 讨论(0)
提交回复
热议问题