Python conda 如何激活环境
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35630276/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
conda how do I activate environments
提问by orgelzyklus
I am struggling to activate conda environments I have created on mac os x. Here are the environment that I have created.
我正在努力激活我在 mac os x 上创建的 conda 环境。这是我创建的环境。
$: 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
我得到以下信息:
which activate
/Students/rt12083/anaconda3/bin/activate
my path
variable is:
我的path
变量是:
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?
我需要做什么来激活环境?
回答by ingrid
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:
您的路径似乎缺少根 anaconda 目录。当我 echo $Path (其中用户名替换我的实际用户名)时,我有以下内容:
/Users/username/anaconda/bin:/Users/username/anaconda/bin:/Users/username/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
/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:
在我的 bash_profile(或 zshrc 文件等)中,我添加了:
export PATH="/Users/username/anaconda/bin:$PATH"
导出路径="/用户/用户名/anaconda/bin:$PATH"
I use iterm2 with zsh, although this probably applies to more general cases.
我将 iterm2 与 zsh 一起使用,尽管这可能适用于更一般的情况。
On OSX Sierra with Anaconda3 4.4.0 the path is now:
在带有 Anaconda3 4.4.0 的 OSX Sierra 上,路径现在是:
export PATH="/anaconda/bin:$PATH"
导出路径="/anaconda/bin:$PATH"
回答by smundlay
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
我使用 miniconda2,所以不确定这是否可行,但是:打开终端并导航到安装了 conda 的任何位置。对我来说它的 /Users/username/miniconda 2
and then do source activate env_name
然后做source activate env_name
and then you can navigate back to your development directory
然后您可以导航回您的开发目录
回答by user9849742
use the following
使用以下
conda create -n your_Env_Name
Then activate it with:
然后使用以下命令激活它:
conda activate your_Env_Name