To configure the anaconda environment variable in Linux, set the PATH environment variable so that you can access anaconda and its managed Python environment from anywhere. The general steps to configure anaconda environment variables are as follows!
anacondade is usually installed in the /home/usernam/anaconda directory. Check the exact installation path of anaconda. If the bash shell configuration file is used, it is usually in bashrc, located in the user's home directory:
nano ~/.bashrc
If you use another shell such as zsh, the configuration file may be located in.zshrc. Open the end of the configuration file and add the following line:
export PATH="/home/ user name /anaconda3/bin:$PATH"
Replace /home/username/anaconda3 with your actual Anaconda installation path. If you are using the nano editor, you can press Ctrl + X, then Y to confirm that you have saved your changes, and finally Enter to exit.
To make the changes take effect immediately, reload the configuration file with the following command:
source ~/.bashrc
Or (for zsh users) :
source ~/.zshrc
Check the path environment variable by running the following command on the terminal:
echo $PATH
If the path to anaconda was added correctly, you should see it in the output. To ensure that all anaconda managed environments are properly identified:
conda init
The above command automatically configures environment variables based on shell type.
Linux box To view all installed anaconda environments, run the conda command to activate anaconda:
conda activate
If using anaconda 2020.11 or later:
conda init
Restart the terminal so that commands are automatically added to the shell. Once anaconda is activated, you can also use the following command to list all installation environments:
conda env list
Or use:
conda info --envs
The above command displays all created environments, such as system environments and other created custom environments. If you want to see other environment-specific information:
conda info -e
The above command displays a list of all environments, including each environment path and activity status.