The latest version of Mac OS X will come with Python 2.x by default.
1. Check whether Python has installed and which version of Python has installed, by entering the python command in the Terminal window, as shown below:
$ python
If you can see the python command runs normally with the output of Python version information, which indicates that the current Mac OS X system has come with Python.
2. Key in “python3” command in the Terminal window to detect whether Python 3.x is currently installed on Mac OS X as because normally the command defaults to the Python 2.x development environment.
$ python3
If the system shows “command not found”, it means the Python 3.x has not yet installed. However, if the python3 command able to run successfully and with the version of Python, then Python 3.x has been installed.
1. Download the source code from the official website.
Python official address: https://www.python.org/downloads/
You can see various versions of Python after clicking on the link.
2. Look for the Python version that you want to install then download it.
3. Click either the Python version number or “Download” button in the figure below in order to enter the download page. Therefore, scroll to the end of the page to look for Python installation packages for each platform.
4. Click the link of macOS 64-bit installer, which is a Python installation package for Mac OS X systems. Then, you will get a python-3.8.1-macosx10.9.kg installation package after downloading.
5. Double-click python-3.8.1-macosx10.9.pkg to enter the Python installation wizard, and then follow the wizard to install it step by step. You just need to keep everything in default.
Finally, we have installed Python, now you can verify again whether the installation is successful by entering python3 in the Terminal. Then you can see the command will enter the Python 3.x development environment.
$ python3
More Tutorials:
Python Installation - Linux (Ubuntu)More Python Exercises:
Python String Exercises