完整路径激活conda环境

编程入门 行业动态 更新时间:2024-10-24 18:20:07
本文介绍了完整路径激活conda环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

通常,我们使用以下命令激活conda环境:

Usually, we activate a conda environment with the command:

source activate env_name

是否可以使用完整路径激活conda环境?例如:

Is it possible to activate conda environment with its full path? For example:

source (fullpath)/bin/activate

执行此操作时,它将激活anaconda的默认环境,即根环境.

When I do this it activates the default environment of anaconda i.e the root environment.

推荐答案

更新conda 4.4及更高版本:

您需要指定要激活的conda环境路径.新的conda activate命令不再需要激活脚本"的完整路径,因为该命令现在已内置"到conda中.像这样:

You need to specify the conda environment path to activate. The new conda activate command should not need the full path to an "activate script" any longer, since the command is now "built-in" to conda. So something like:

conda activate (fullpath)/env-name-here

应该工作.

您指定的命令将激活root环境,因为您没有为conda提供要激活的环境,并且root是默认环境.如果您想激活特定的环境,当然可以使用activate脚本的完整路径来实现,例如

The command you have specified activates the root environment because you have not given conda an environment to activate, and root is the default. If you want to activate a particular environment, you can certainly do so with the full path to the activate script, for instance

source (full path to main Anaconda directory)/bin/activate (fullpath)/env-name-here ^^^^^^^^^^^^^^^^^^^^^^^^ You're missing this part

更多推荐

完整路径激活conda环境

本文发布于:2023-11-30 05:35:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648900.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   完整   环境   conda

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!