Change the Default Base Environment in Conda
Problem:
on linux (debian12), how to change the default 'base' env in conda? current 'base' env use python12, i wnat use python11 as my default base env fo conda, how to do that?
Solution:
To change the default base
environment in Conda to use Python 3.11 instead of Python 3.12 on Debian 12, follow these steps:
Step 1: Check Your Current base
Environment
- Activate the
base
environment:conda activate base
- Check the Python version:
If it's showing Python 3.12, you'll need to update it.python --version
Step 2: Install Python 3.11 in the base
Environment
- Update Conda to ensure you have the latest packages:
conda update conda conda update --all
- Replace the Python version in the
base
environment:
This will resolve dependencies and replace Python 3.12 with Python 3.11 in theconda install python=3.11
base
environment.
Step 3: Verify the Change
Confirm the Python version after installation:
python --version
It should now show Python 3.11.
Deactivate and reactivate
base
to ensure changes persist:conda deactivate conda activate base
Step 4: Set Conda to Always Use the base
Environment on Start (Optional)
If you always want to activate the base
environment when opening a terminal:
- Edit your shell initialization file (e.g.,
.bashrc
or.zshrc
):nano ~/.bashrc
- Add this line at the end:
conda activate base
- Save and reload your shell:
source ~/.bashrc
Now, your Conda base
environment will use Python 3.11 by default!