conda activate命令激活不了虚拟环境

conda activate命令激活不了虚拟环境

  • 问题描述
        • conda activate workspace报错:
  • 解决方法

问题描述

conda activate workspace报错:

        conda:未找到命令
        CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.

If your shell is Bash or a Bourne variant, enable conda for the current user with

source activate workspace报错:

-bash: actiivate: 没有那个文件或目录

conda --version报错:

`conda:未找到命令`

解决方法

#解决方法一
[1]echo ". /home/xuxiang/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc  #在.bashrc中添加了一行路径
[2]conda activate    #conda's base (root) environment on PATH
[3]echo "conda activate" >> ~/.bashrc  #bashrc中写
[4]soure ~/.bashcr  #激活bashrc
#解决办法二(不永久,每次都需要如此操作)
cd ..  #进入根目录
cd ./xuxiang/anaconda3/bin      #进入anaconda3文件夹下的bin文件夹
source activate base       #这样就可以了
conda activate workspace

#试试
conda --version
>>>conda 4.4.10
conda activate workspace     #成功激活虚拟环境

#解决方法三,在bashrc文件中加入以下指令
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/malin/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/malin/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/home/malin/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/malin/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

你可能感兴趣的:(bug,jupyter,ide,python)