如何暂时摆脱anaconda / conda shell环境

时间:2019-02-23 19:27:56

标签: anaconda conda

一旦您安装了anaconda / conda,并配置了shell初始化文件来设置路径,您如何才能暂时退出该环境以使用系统工具,例如本机安装的python版本?

2 个答案:

答案 0 :(得分:1)

如果您进行了默认安装,因此遵循了the best practice configuration introduced in Conda v.4.4,那么只需停用 base env:

conda deactivate

答案 1 :(得分:0)

merv的答案更好...

这是一种无需编辑一个人的init文件即可立即执行此操作的方法:

(base) ➜  ~ which python
/home/xxx/anaconda3/bin/python
(base) ➜  ~ echo $PATH
/home/xxx/anaconda3/bin:/home/xxx/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
(base) ➜  ~ export PATH=$(echo ${PATH} | awk -v RS=: -v ORS=: '/conda/ {next} {print}' | sed 's/:*$//')
(base) ➜  ~ echo $PATH                                                                
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
(base) ➜  ~ which python
/usr/bin/python
(base) ➜  ~