Configuring Anaconda environment variables on Ubuntu platform

        Sometimes the ubuntu system will have some problems and need to be reinstalled. The anaconda installed does not need to be reinstalled. Just back up the anaconda3 folder. After installing the new system, copy the anaconda3 folder to the required location, and then reconfigure the following environment variables to use the anaconda virtual environment normally.

        After newly installing anaconda, you sometimes need to configure Ubuntu environment variables.

        The specific steps are as follows:

1. Open the console and edit the environment variable configuration file

# vi或者gedit都可以
vi ~/.bashrc
# 或者
gedit ~/.bashrc

2. Add the following code at the end of the configuration file

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

3. Effective environment variables

# 输入以下命令或者重启系统
source ~/.bashrc

Guess you like

Origin blog.csdn.net/myemailsz/article/details/131452604