'How can I update to the latest Python version using conda?

I am new to Python. I was asked to update to the latest Python version using conda.

So far, I have installed Anaconda on my Mac. So I am mainly using the Terminal.

Thank you in advance.



Solution 1:[1]

Without virtual environment or inside the environment, you can update python as follow:

conda update python

Or you can upgrade or downgrade the environment python version:

conda install python=3.7

Updating or Upgrading Python

Solution 2:[2]

Open conda shell prompt. (On Windows Anaconda Powershell Prompt)

You first check

conda search python

You will get all the supported versions. It may look like:

Loading channels: done
# Name                       Version           Build  Channel
python                        2.7.13     h1b6d89f_16  pkgs/main
python                        2.7.13     h9912b81_15  pkgs/main
python                        2.7.13     hb034564_12  pkgs/main
python                        2.7.14     h2765ee6_18  pkgs/main
python                        2.7.14     h3e68818_15  pkgs/main
python                        2.7.14     h4084c39_22  pkgs/main
python                        2.7.14     h4a10d90_30  pkgs/main
python                        2.7.14     h4a10d90_31  pkgs/main
python                        2.7.14     h59f5a59_20  pkgs/main
python                        2.7.14     h819644d_16  pkgs/main
python                        2.7.14     h8c3f1cb_23  pkgs/main
python                        2.7.15      h2880e7c_2  pkgs/main
python                        2.7.15      h2880e7c_3  pkgs/main
python                        2.7.15      h2880e7c_4  pkgs/main
python                        2.7.15     hcb6e200_15  pkgs/main
python                        2.7.15      hcb6e200_5  pkgs/main
python                        2.7.15      hcb6e200_7  pkgs/main
python                        2.7.15      he216670_0  pkgs/main
python                        2.7.16      hcb6e200_0  pkgs/main
python                        2.7.17      h930f6bb_0  pkgs/main
python                         3.5.4     h1357f44_23  pkgs/main
python                         3.5.4     hc495aa9_21  pkgs/main
python                         3.5.4     hd3c4935_11  pkgs/main
python                         3.5.4     hdec4e59_20  pkgs/main
python                         3.5.4     hedc2606_15  pkgs/main
python                         3.5.5      h0c2934d_0  pkgs/main
python                         3.5.5      h0c2934d_1  pkgs/main
python                         3.5.5      h0c2934d_2  pkgs/main
python                         3.5.6      he025d50_0  pkgs/main
python                         3.6.2     h09676a0_15  pkgs/main
python                         3.6.2     h6679aeb_11  pkgs/main
python                         3.6.3      h210ce5f_2  pkgs/main
python                         3.6.3      h3389d20_0  pkgs/main
python                         3.6.3      h3b118a2_4  pkgs/main
python                         3.6.3      h9e2ca53_1  pkgs/main
python                         3.6.4      h0c2934d_2  pkgs/main
python                         3.6.4      h0c2934d_3  pkgs/main
python                         3.6.4      h6538335_0  pkgs/main
python                         3.6.4      h6538335_1  pkgs/main
python                         3.6.5      h0c2934d_0  pkgs/main
python                         3.6.6      hea74fb7_0  pkgs/main
python                         3.6.7      h33f27b4_0  pkgs/main
python                         3.6.7      h33f27b4_1  pkgs/main
python                         3.6.7      h9f7ef89_2  pkgs/main
python                         3.6.8      h9f7ef89_0  pkgs/main
python                         3.6.8      h9f7ef89_1  pkgs/main
python                         3.6.8      h9f7ef89_7  pkgs/main
python                         3.6.9      h5500b2f_0  pkgs/main
python                         3.7.0      hea74fb7_0  pkgs/main
python                         3.7.1      h33f27b4_3  pkgs/main
python                         3.7.1      h33f27b4_4  pkgs/main
python                         3.7.1      h8c8aaf0_6  pkgs/main
python                         3.7.1      he44a216_5  pkgs/main
python                         3.7.2      h8c8aaf0_0  pkgs/main
python                         3.7.2     h8c8aaf0_10  pkgs/main
python                         3.7.2      h8c8aaf0_2  pkgs/main
python                         3.7.3      h8c8aaf0_0  pkgs/main
python                         3.7.3      h8c8aaf0_1  pkgs/main
python                         3.7.4      h5263a28_0  pkgs/main
python                         3.7.5      h8c8aaf0_0  pkgs/main
python                         3.8.0      hff0d562_0  pkgs/main
python                         3.8.0      hff0d562_1  pkgs/main
python                         3.8.0      hff0d562_2  pkgs/main

Then simple select the version conda install python=3.8.0 if this is the last version.

Solution 3:[3]

I believe what was requested from you is to create a virtual environment with the latest python version. You can do by executing the command:

conda create -n my_env python=3.7

Here my_env is simply the name of the environment so you can replace it with anything. Also python 3.7 is the latest python version as of the time of this writing but may need to be changed with later version in the future.

Once you've created the environment you can activate it by typing source activate my_env (as the helpful conda message will point out).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 prosti
Solution 3 Dan Grahn