For now you need the latest version of Python on your Mac
Python is a popular programming language for creating applications on desktop and web platforms. This is also known as a great place to start new coders, based on their syntax and easy flexibility. We will show you how to install the latest version of Python on your Mac.
The instructions in this article apply to the latest versions of Python and macOS.
Which version of Python must be installed on macOS
Python is pre-installed on macOS, but the built-in version is specific to the version of macOS that you are running. This means it is only updated when you receive an OS update from Apple. So, if you choose to use a version that already exists on macOS, you might be running a version that is a little older than the current version.
Your other alternative is to install a newer version directly from the Python project. Doing this comes with a warning yourself, which is that you must follow the new release yourself.
Before deciding this, consider the following:
- Is your Python program solely for your own use, on your own Mac? If so, the default version might be enough.
- Will you release your program for use on certain platforms? When this happens, it depends on how the platform tracks the release of Python (or not). If you only target macOS with your code, then the default version is actually a good choice, because you will always know that the version you are using is one that your users will have too. However, if you are writing a web application, you should consider the version of Python that is supported by your web hosting company.
- Some operating systems, such as Linux, will closely follow the latest Python release. In this case you can also use a newer version, to take advantage of newer features.
You have to decide that you need the latest and greatest after thinking about the points above, the following section will show you how to install it on macOS.
Install Python on macOS
The Python project creates regular Python releases in the standard .PKG format. The following steps will install a standard Python distribution on your Mac:
- First, get the latest release from the Python website. Unless you are using an older machine and must use the previous version of macOS for some reason, you can download the 64-bit installer file.
- This is the macOS standard. PPG format, so you just need to click on the installer file to continue.
- The first screen will give you some info about the installation, you can click Continue to continue.
- Click Continue on the following page too, which is a notification that the project will stop providing support for 32-bit installers from v3.8 onwards.
- The next screen asks you to accept an open-source license for Python. You can click Continue here safely, then click Agree.
- You must select a destination for installation on the following screen. You can click Install to place it on your main drive, or click Customize to place it elsewhere.
- The installer will now start copying files, and the progress bar will notify you when it is finished.
- After the installation is complete, the application folder will open in the Finder.
Confirming Your Python Installation
To make sure your Python installation works correctly, try the following command in Terminal:
python --version Python 3.7.4
If you want to confirm further, try running a simple Python script. Enter (or paste) the following code into a blank text file and name it “hello-world.py”:
print ("Hello World!")
Now, at a command prompt, run the following:
python /path/to/hello-world.py Hello World!
If you get the above output, your latest Python installation is ready to use.