You can download the Python for free at https://python.org/, and there are versions for Linux, macOS, and Windows.
To set up Python for Mac, I use Homebrew. Firstly, check if you have Homebrew
$ brew --version
First, we’ll install Xcode, which Homebrew requires, and then Homebrew.
$ xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install python
To upgrade Python with Homebrew, we can use the following code.
brew upgrade python
Firstly we add this command
ln -s -f /usr/local/bin/python3.9 /usr/local/bin/python
Close the current terminal session and open a new terminal window (not tab). Run this:
We will get this