-1
  1. According to python.org, 3.8.2 is currently the latest version of Python.
  2. When I try to upgrade python3 using Homebrew (freshly upgraded), it tells me version 3.7.6_1 is already installed.
  3. When I ask python3 for it's current version, it tells me 3.7.3.

See terminal runs:

Nannas-Computer:some_folder username$ brew update
Already up-to-date.
Nannas-Computer:some_folder username$ brew upgrade
Nannas-Computer:some_folder username$ brew upgrade python3
Warning: python3 3.7.6_1 already installed
Nannas-Computer:some_folder username$ python3 --version
Python 3.7.3

Why are all these versions different, and how can I install the 3.8.2 version on my mac (macOS Mojave, version 10.14.6)?

Nanna
  • 515
  • 1
  • 9
  • 25

2 Answers2

4

You can install Python 3.8.x using command:

brew install python@3.8

As it's not main Python distribution on Homebrew, by default it's not accessible by simple typing python3. Binary is located in /usr/local/Cellar/python@3.8/3.8.2/bin/python3.8 and you can create a symlink to it or use directly by typing full path.

It's not that cumbersome as one may think because usually the only thing you need to do is to create a virtual environment and activate it. Since then it'll be your default Python (for this virtualenv):

$ /usr/local/Cellar/python@3.8/3.8.1/bin/python3.8 -m venv my_venv
$ source my_venv/bin/activate
(my_venv)$ python
Python 3.8.1 (default, Dec 27 2019, 18:06:00)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Tupteq
  • 2,986
  • 1
  • 21
  • 30
1

After some research I found out the following reasons:

  • It is possible to upgrade to Python 3.8.2 via Homebrew, but it isn't listed as supplying python due to some complications. See status here. Until this issue is done, 3.7.6_1 is the newest version you can upgrade to (as Homebrew kept telling me).

  • When I ran python3 --version in terminal, it returned Python 3.7.3 because I had installed this version myself at some point from the official website, without using Homebrew. Upgrading python to 3.7.6 via Homebrew had no effect on this dominating installation of python. I got rid of the manually installed version using this useful answer, after which I reinstalled python properly using Homebrew just to be on the safe side and now I finally have:

    Nannas-Computer:some_folder username $ python3 --version
    Python 3.7.6
    
Nanna
  • 515
  • 1
  • 9
  • 25
  • Your original question asked: "how can I install the 3.8.2 version on my Mac." Tupteq's answer above is a simple and direct way to install and use Python 3.8. Then create and activate a venv using 3.8 (see above), then you can easily use Python 3.8. It works. – Bruce Dean Apr 26 '20 at 15:08
  • Thank you, I know it works. It however only answers a part of the original question: "Why are all these versions different, and how can I install the 3.8.2 version on my mac (macOS Mojave, version 10.14.6)?". The answer posted here also states that it is possible to upgrade to Homebrew, but doesn't go into details as to how, like Tupteq's very informative answer does, and that's why I upvoted his answer. – Nanna Apr 27 '20 at 16:11