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:
In summary, if you edit . condarc to include D:\envs , and then run conda env create -p D:\envs\myenv python=x.x , then activate myenv (or source activate myenv on Linux) should work. Hope that helps!
To activate your Conda environment, type source activate <yourenvironmentname> . Note that conda activate will not work on Discovery with this version. To install a specific package, type conda install -n <yourenvironmentname> [package] . To deactivate the current, active Conda environment, type conda deactivate .
I'd like to mention one more thing here. While you can have multiple environments that contain different versions of Python at the same time on the same computer, you can't set up 32- and 64-bit environments using the same Conda management system.
create a folder wherever you want to keep you environment files, inside the folder run:
conda create --prefix=yourenvname
When you wish to use this env, move to the folder in which you ran the previous command and do:
source activate yourenvname
Or
You can run:
conda create --prefix=path/yourenvname
This will create environment named "yourenvname" in the specified path.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With