having default Mac Python 2.7 and Anaconda Python 3

Viewed 5950

I want to keep the Mac Python as my main 'python'. The reason for that is the recommendation in Python website here. I also want to add a separate environment for my Python3 (Anaconda).

For doing that I installed the Anaconda Python to get access to Conda and then I made an environment for my Python3 using the following command:

conda create -n py36 python=3.6 anaconda

When I installed the Anaconda python it added this to my .bash_profile file to get access to all conda commands:

# added by Anaconda3 4.4.0 installer
# export PATH="/Users/omidb/anaconda/bin:$PATH"

Now my default python is anaconda python which I don't want to.

How can I have default Mac python as my main python and then when I needed Anaconda, just use source activate py36 ?

2 Answers

Faced the same problem and question is too old but the simplest of doing this which I found is:


1. Let's check if the default python version is pointing to Conda python
which python - If Conda installation updated to your bashrc or zshrc, it will show that path
  1. Running Command:

    conda config --set auto_activate_base false

It's will make sure that when you start the terminal, Conda doesn't get activated as base

Now if you check python --version or which python - It should be pointing to mac default python version

  1. Now whenever you want to use conda, all conda commands are available with conda <command>

  2. Create the virtual env using conda create --name venv and activate it using conda activate <venv_name>

Now, I am able to use different python versions I required with conda and default python version as system default

Related