Linux conda activate报错:CondaError: Run ‘conda init‘ before ‘conda activate‘
Linux conda activate报错:CondaError: Run ‘conda init’ before ‘conda activate’
在Centos7.9的Linux系统环境下,64位,安装玩Conda,输入
conda activate testconda
报错,提示说运行conda activate前需要先运行conda init
[root@bigdata-server python]# conda activate testconda
Ignoring configuration file (/root/.condarc) due to error:
Unable to load configuration file.
path: /root/.condarc
reason: invalid yaml at line 44, column 0
Ignoring configuration file (/root/.condarc) due to error:
Unable to load configuration file.
path: /root/.condarc
reason: invalid yaml at line 44, column 0
Ignoring configuration file (/root/.condarc) due to error:
Unable to load configuration file.
path: /root/.condarc
reason: invalid yaml at line 44, column 0
Ignoring configuration file (/root/.condarc) due to error:
Unable to load configuration file.
path: /root/.condarc
reason: invalid yaml at line 44, column 0
CondaError: Run 'conda init' before 'conda activate'
但是输入conda init,却没有什么效果。
conda init
conda init完之后,conda activate testconda仍然报错:CondaError: Run ‘conda init’ before ‘conda activate’
【解决办法】
查找conda的环境路径
[root@bigdata-server python]# which conda
/root/anaconda3/bin/conda
添加codna的环境路径
vim ~/.bashrc
在最后一行添加
export CONDA_ENVS_PATH=~/anaconda3/envs
保存退出。
source ~/.bashrc
再输入conda activate testconda
conda activate testconda
正常。