简体   繁体   中英

conda how do I activate environments

I am struggling to activate conda environments I have created on mac os x. Here are the environment that I have created.

$: conda env list
# conda environments:
#
py34                     /Students/rt12083/anaconda3/envs/py34
py35                     /Students/rt12083/anaconda3/envs/py35
root                  *  /Students/rt12083/anaconda3

When I try to activate them I get the following error:

$: source activate py34
activate: No such file or directory.

When i run the command which activate I get the following:

which activate
/Students/rt12083/anaconda3/bin/activate

my path variable is:

garnet: echo $PATH

/sw/bin:/sw/sbin:.:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/    Developer/Tools:/usr/local/GMT4.5.7/bin:/usr/local/TauP/bin:/usr/local/SU/bin:/usr/local/sac/bin:/usr/local/sac/iaspei:/usr/local/sac/macros:/Students/rt12083/anaconda3/bin

What do I need to do to activate the environments?

Your path seems to be missing the root anaconda directory. when i echo $Path (where username is replacing my actual username) i have the following:

/Users/username/anaconda/bin:/Users/username/anaconda/bin:/Users/username/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

in my bash_profile (or zshrc file etc...) I added:

export PATH="/Users/username/anaconda/bin:$PATH"

I use iterm2 with zsh, although this probably applies to more general cases.

On OSX Sierra with Anaconda3 4.4.0 the path is now:

export PATH="/anaconda/bin:$PATH"

use the following

conda create -n your_Env_Name

Then activate it with:

conda activate your_Env_Name

I use miniconda2, so not sure if this will work but: open terminal & navigate to wherever you have conda installed. for me its /Users/username/miniconda 2

and then do source activate env_name

and then you can navigate back to your development directory

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM