How To Install Python With Conda

Installing Python using Anaconda is very easy. Let us first install the latest version of Anaconda.

Install Anaconda on Linux

Go to the following link and copy the link under section "Linux"

https://www.anaconda.com/products/individual

Go to any directory and execute following commands.

In [ ]:
wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
In [ ]:
./Anaconda3-2021.05-Linux-x86_64.sh

Now you will be prompted with few questions as shown below, go ahead and add appropriate values.

In [ ]:
Please, press ENTER to continue (Press Enter)
[/root/anaconda3] >>> /home/anaconda3 (location where Anaconda will be installed - I chose my home directory.)

Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes (Type Yes)

After Anaconda installation is finished. We can check the version.

In [2]:
conda --version
conda 4.10.1

To check the current Conda environment...

In [1]:
echo $CONDA_DEFAULT_ENV
base

How To install Python3.9 With Conda

To install Python3.9, we will have to create a new Conda environment.

In [ ]:
conda create -n py39 python=3.9

Let us check the list of available Conda environments now.

In [3]:
conda info --envs
# conda environments:
#
base                  *  /home/anaconda3
py39                     /home/anaconda3/envs/py39

To activate the python3.9 Conda environment, type following command...

In [ ]:
conda activate py39

Now if you type and hit "tab", you should see Python3.9 in the list of available Python versions.

In [ ]:
>>>
(py39) [root@ns3273416 downloads]# python
python                                        python3-config                                python3.6-debug-config                        python3.6m-x86_64-config
python-argcomplete-check-easy-install-script  python3-debug                                 python3.6dm                                   python3.9
python-argcomplete-tcsh                       python3-debug-config                          python3.6dm-config                            python3.9-config
python2                                       python3.6                                     python3.6dm-x86_64-config
python2.7                                     python3.6-config                              python3.6m
python3                                       python3.6-debug                               python3.6m-config