anaconda - What is conda shell activation?
问题描述
Anaconda Installing in silent mode says
The installer will not prompt you for anything, including setup of your shell to activate conda. To add this activation in your current shell session:
eval "$(command conda 'shell.bash' 'hook' 2> /dev/null)"
What does this line actually do and what files (eg. update bashrc or bash_profile, etc) are affected?
After having done this, what will happen when I open a bash shell or start a new login?
If there is a detailed documentation, please suggest.
解决方案
TLDR;Conda shell 激活是定义一些有助于激活和停用 Conda 环境的 shell 函数的过程,以及一些可选功能,例如更新 PS1 以显示活动环境。
在 Conda v4.4 中,对 Conda 管理环境隔离的方式进行了重大改革。其中一部分是使用带有or之conda()
类的参数的 shell 函数来管理环境的激活,而不是拥有用户以前必须使用的脚本。activate
install
activate
source activate
OP 中的特定命令生成 bash 代码来定义conda()
函数、它需要的一些辅助函数和环境变量,然后在您当前的 shell 中评估此代码。这不是一个固定脚本的原因是,Conda 在这里所做的工作是使用conda
入口点(即 Python 代码)动态生成的,并考虑了~/.condarc
.
您只需运行即可完全检查此代码而无需对其进行评估
conda shell.bash hook
这会将代码输出为字符串。每个人都会看到的共同元素是conda()
函数及其辅助元素(例如,以 开头__conda_
)。其他方面取决于配置。例如,如果auto_activate_base
为 true(默认值),则最后conda activate base
会发出 a。
推荐阅读
- docker - 如何以最佳方式在多台物理机上部署 Kubernetes 集群?
- javascript - 如何将异步等待响应传递给 Vue?
- excel - 仅查找一列的所有选项
- postgresql - 将包含范围的行拆分为两个边界
- angular - 角度术语/数据绑定
- html - 弹出菜单的三角形指向箭头
- javascript - 如何在下一个输入元素中获取选择选项数据
- mysql - MySQL - 比较同一张表中的不同键和值
- firebase - 将 Chrome 扩展程序连接到 Firebase RTB 时出错:“firebase.database 不是函数”
- android - JADX 从混淆的应用程序中获取类名