Can I choose where my conda environment is stored?

六眼飞鱼酱① 提交于 2019-12-03 03:41:48

问题


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 with virtualenv)

$conda info -e
Using Anaconda Cloud api site https://api.anaconda.org
# conda environments:
#
_build                   /Users/nolan/miniconda/envs/_build
myen3                    /Users/nolan/miniconda/envs/myen3
nolanemirot              /Users/nolan/miniconda/envs/nolanemirot
root                  *  /Users/nolan/miniconda

回答1:


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



回答2:


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".




回答3:


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



来源:https://stackoverflow.com/questions/35280479/can-i-choose-where-my-conda-environment-is-stored

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!