美文网首页
切换默认conda2023-02-27

切换默认conda2023-02-27

作者: 土雕艺术家 | 来源:发表于2023-02-26 18:24 被阅读0次

    因为同时安装了mambaanaconda3,而默认使用mamba的时候有些包的运行会出错误,所以打算切换回原先conda。

    # conda environments:
    #
                             /path/anaconda3
    base                  *  /path/mambaforge-pypy3
    
    

    主要是修改~/.bashrc
    如果只有一个默认设置应该是这样的。

     >>> conda init >>>
    # !! Contents within this block are managed by 'conda init' !!
    __conda_setup="$(CONDA_REPORT_ERRORS=false '/path/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
    if [ $? -eq 0 ]; then
        \eval "$__conda_setup"
    else
        if [ -f "/path/anaconda3/etc/profile.d/conda.sh" ]; then
            . "/path/anaconda3/etc/profile.d/conda.sh"
            CONDA_CHANGEPS1=false conda activate base
        else
            \export PATH="/path/anaconda3/bin:$PATH"
        fi
    fi
    unset __conda_setup
    

    使用了mamba的是这样的配置

    # >>> conda initialize >>>
    # !! Contents within this block are managed by 'conda init' !!
    __conda_setup="$('/path/mambaforge-pypy3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
    if [ $? -eq 0 ]; then
        eval "$__conda_setup"
    else
        if [ -f "/path/mambaforge-pypy3/etc/profile.d/conda.sh" ]; then
            . "/path/mambaforge-pypy3/etc/profile.d/conda.sh"
        else
            export PATH="/path/mambaforge-pypy3/bin:$PATH"
        fi
    fi
    unset __conda_setup
    
    if [ -f "/path/mambaforge-pypy3/etc/profile.d/mamba.sh" ]; then
        . "/path/mambaforge-pypy3/etc/profile.d/mamba.sh"
    fi
    # <<< conda initialize <<<
    
    

    /path/mambaforge-pypy3替换为/path/anaconda3
    source ~/bashrc更新设置
    再启动新的窗口就是用了anaconda3

    # conda environments:
    #
    base              */path/anaconda3
                       /path/mambaforge-pypy3
    
    

    相关文章

      网友评论

          本文标题:切换默认conda2023-02-27

          本文链接:https://www.haomeiwen.com/subject/gvscldtx.html