When I run:
source activate /anaconda2/envs/myEnv
it shows the entire directory of this conda environment in my prompt (on iterm2) as so:
(/Users/billy/anaconda2/envs/myEnv)billy@mbp:~/projects
Is this a way to shorten this, so that it just shows the name of the conda environment and not the entire directory? For example as:
(myEnv)billy@mbp:~/projects
Thanks.
You can try the following:
Make sure that /anaconda2/envs
is listed in the section envs_dirs
in the output for the command:
$ conda config --show
If it is not present, you can add it like this:
$ conda config --add envs_dirs /anaconda2/envs
Then, activate the environment like this:
$ source activate myEnv
Example:
(root) ~/condaexpts ❯❯❯ conda create -yp /tmp/miniconda2/myEnv
Fetching package metadata .......
.Solving package specifications: .
Package plan for installation in environment /tmp/miniconda2/myEnv:
The following empty environments will be CREATED:
/tmp/miniconda2/myEnv
#
# To activate this environment, use:
# > source activate /tmp/miniconda2/myEnv
#
# To deactivate this environment, use:
# > source deactivate /tmp/miniconda2/myEnv
#
(root) ~/condaexpts ❯❯❯ conda config --add envs_dirs /tmp/miniconda2
(root) ~/condaexpts ❯❯❯ source activate myEnv
(myEnv) ~/condaexpts ❯❯❯