How to set the default python path for anaconda on Linux?
The comments somewhat cover the answer to the question, but to clarify:
When you installed Anaconda you must have agreed to have it added to your PATH. You'll want to check in your
~/.bash* files and look for any
export PATH= lines to check this. So Anaconda is always on your path. The
source deactivate command will only deactivate "sub" Conda environments. It will never remove what is called the "root" Conda environment (the one you originally installed). If you don't want Anaconda on your
PATH by default then remove it from your
~/.bash* startup files. Then when you want to use Anaconda you'll need to add it to your
PATH. Or just add the specific Conda environment you are interested in to your
PATH directly, and don't worry about the
deactivate scripts. At their core all they do is modify
I hope that helps clarify things.
Use the default Python rather than the Anaconda installation when called from the terminal
Anaconda adds the path to your
.bashrc, so it is found first. You can add the path to your default Python instance to
.bashrc or remove the path to Anaconda if you don't want to use it.
You can also use the full path
/usr/bin/python in Bash to use the default Python interpreter.
If you leave your
.bashrc file as is, any command you run using
python will use the Anaconda interpreter. If you want, you could also use an
alias for each interpreter.
You will see something like
export PATH=$HOME/anaconda/bin:$PATH in your
So basically, if you want to use Anaconda as your main everyday interpreter, use the full path to your default Python or create an
alias. If you want it the other way around, remove the
export PATH=.... from
bashrc and use full path to Anaconda Python interpreter.
How to change default Anaconda python environment
If you just want to temporarily change to another environment, use
source activate environment-name
ETA: This may be deprecated. I believe the current correct command is:
source conda activate environment-name
(you can create
To change permanently, there is no method except creating a startup script that runs the above code.
Typically it's best to just create new environments. However, if you really want to change the Python version in the default environment, you can do so as follows:
First, make sure you have the latest version of conda by running
conda update conda
conda install python=3.5
This will attempt to update all your packages in your root environment to Python 3 versions. If it is not possible (e.g., because some package is not built for Python 3.5), it will give you an error message indicating which package(s) caused the issue.
If you installed packages with pip, you'll have to reinstall them.
How do I set Anaconda's python as my default python command?
PATH is pointing to the original Python executable. You have to update your
(Assuming Windows 7)
Right-click on Computer, the Properties, the Advanced system settings, then click the Environment Variables... button.
The lower window has the system variables. Scroll down until you find Path, select it, and click edit. In the screen that appears, update the path that is pointing to your original python.exe to the one that is in the anaconda path.
Close any open command window for update to take effect.
How to only use anaconda python when needed (in linux)
After a default install, follow the directions on using
conda init to configure your shell to use Conda. Then disable auto-activation of the base environment:
conda config —-set auto_activate_base false
This will let you use the system-level Python installation by default. You can use
conda activate <env_name> to activate environments, or simply
conda activate for the base environment.