Search code examples
python-3.xanaconda3

How to update Python to the latest version in Conda environment?


I have tried the following command, but no luck there.

conda update python
PackageNotInstalledError: Package is not installed in prefix.
  prefix: /home/shrivatsa/anaconda3/envs/machine_learning
  package name: python

Solution

  • First check for all the python version available to install using conda search python. It will give list like below.

    # Name                       Version           Build  Channel             
    python                        2.7.13     hac47a24_15  pkgs/main           
    .
    .
    .
    python                         3.8.2      h191fe78_0  pkgs/main           
    python                         3.8.2      hcf32534_0  pkgs/main           
    python                         3.8.2     hcff3b4d_13  pkgs/main           
    python                         3.8.2     hcff3b4d_14  pkgs/main           
    python                         3.8.3      hcff3b4d_0  pkgs/main           
    python                         3.8.3      hcff3b4d_2  pkgs/main  
    

    Then, install the latest version using conda install python=3.8.3.