Issue
I have installed anaconda
on Ubuntu 20.04 (conda --version
says conda 22.9.0
).
Now the global python version (which python
) is controlled by anaconda
since it
installs its init code in .bashrc
:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/user/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/user/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/user/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/user/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
For testing purposes I sometimes want to use the standard distro python version and packages.
How can an easily switch between anaconda
and the distro python version?
My current work-around is to use conda init --no-user
or commenting the above conda init script in .bash.rc
to achieve this (requires opening a new shell)...
Solution
Conda installation comes with a default environment, often named base
. That's what you see when typing which python
: it links to the conda version of python.
As any other conda virtual environment, you can deactivate this base environment through conda deactivate
.
If you do not want this base environment to be activated when opening a new terminal, you can use conda config --set auto_activate_base false
.
You could then activate this default environment when needed, through conda activate base
.
Answered By - Théo Rubenach Answer Checked By - Marilyn (WPSolving Volunteer)