OS: Windows 10
It's fine to create an env with either name or path, but it doesn't work with both name and path:
Command:
conda create -name myname --prefix D:\proj\myconda\myname
Error:
conda create: error: argument -p/--prefix: not allowed with argument -n/--name
So how to create an env both with a specific name and path?
The benefit from that is:
Create conda environment with prefix:
conda create --prefix=path/to/envname # C:\path\to\envname for Windows users
Make sure that the directory specified is added to envs_dirs
configuration
conda config --append envs_dirs path/to/envname # again, change if using Windows
Tip: If you are keeping multiple environments under a directory (e.g. /path/to holds multiple conda environments), then you can
conda config --append envs_dirs path/to # again, change if using Windows
and conda will pick up on all environments stored in /path/to
.
After this step, conda should recognize that you want to include envname in your named environments. You can verify with:
conda info --envs
which should return something like:
# conda environments:
#
envname /path/to/envname
Finally, to activate the environment, all you should need to do is
conda activate envname # replace envname with your environment name from prefix