禁止Conda默认进入base环境
问题介绍
安装anaconda
后取消命令行前出现的base
,取消每次启动自动激活conda
的基础环境。
造成原因
conda
默认设置。
解决方案
- 方法一:
- 每次通过进入命令行后通过
conda deactivate
退出base
环境回到系统自动的环境
- 每次通过进入命令行后通过
- 方法二
- 希望在启动时不激活
conda
的base
环境,通过将auto_activate_base
参数设置为false
,conda config --set auto_activate_base false
- 那要进入的话通过
conda activate base
- 如果反悔了,还是希望
base
一直留着,通过conda config --set auto_activate_base true
来恢复
- 希望在启动时不激活
文档建议
有一种更合适的方法,就是直接取消conda默认的显示环境的设置,如下所述:
To simply return to the
base
environment, it’s better to callconda activate
with no environment specified, rather than to try to deactivate. If you runconda deactivate
from yourbase
environment, you may lose the ability to run conda at all. Don’t worry, that’s local to this shell - you can start a new one. By default, the command prompt is set to show the name of the active environment. To disable this option:
conda config --set changeps1 false
To re-enable this option:
conda config --set changeps1 true