Likewise in a Linux environment, macOS also have Python installed by default. But you need to get an idea of the basic installation steps as it will help with updates and reinstallations.
Setting up a Python environment in macOS
Getting ready
First of all, install Xcode from the App Store, if you haven't installed it already. And then update the command-line tools with the following command:
$ xcode-select --install
Also, we need to install Homebrew, a package manager for macOS, for that open terminal and type the following command:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"