Xcode is Apple's Integrated Development Environment (IDE). You might already have Xcode on your Mac. If not, you can get Xcode from Apple appstore.
Luckily, there are two ways to install Python 3 on a Mac with ease. First and foremost, I recommend looking into Homebrew. It allows you to install almost anything easily. The added benefit is that it’s also easy to upgrade to newer versions later on. Once you are up and running with homebrew, installing Python on MacOS is as easy as.
Homebrew installs the stuff you need. Homebrew is a package manager for Mac OS
Step 1. Launch Terminal.
Go to Launchpad – Other – Terminal
Step 2. Install HomeBrew
Enter brew command into terminal
brew install python3
Set up PATH environment variable, if you used HomeBrew to install Python3, then HomeBrew already added PATH.
Do not change PATH environment if you can launch python3 from terminal.
Add the following line to your ~/.profile file
Usually your Python installation directory looks like this, add it to your PATH