Install New Versions of Python on macOS

This section provides a tutorial example on how to install newer version of Python on macOS.

If the pre-installed version of Python is too old on your macOS computer, you can download and install a newer version as shown below:

1. Go to Python download Website at https://www.python.org/downloads/.

2. Click "Download Python 3.8.0" button. And save the download file.

3. Double-click on the download file "python-3.8.0-macosx10.9.pkg" and follow installation instructions to finish the installation.

4. Go to the Launchpad. You see 2 new applications: Python IDLE and Python Launcher.

There are a number of ways to use the newer version of Python:

Note that the newer version of Python did not replace the older version. So you have two versions of Python on your macOS located at different directories.

Python 2.7 Version - This is the older version pre-installed in the macOS system. You can access Python 2.7 with the "python" command:

herong$ python --version
Python 2.7.10

herong$ which python
/usr/bin/python

Python 3.8 Version - This is the newer version installed by you. You can access Python 3.8 with the "python3" command:

herong$ python3 --version
Python 3.8.0

herong$ which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3

herong$ ls -l /usr/local/bin/python3
... /usr/local/bin/python3 -> \
   ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3

Table of Contents

 About This Book

 Running Python Code Online

Python on macOS Computers

 Run Python Scripts on macOS

Install New Versions of Python on macOS

 pip3 - Package Installer for Python 3

 Python on Linux Computers

 Built-in Data Types

 Variables, Operations and Expressions

 Statements - Execution Units

 Function Statement and Function Call

 Iterators and Generators

 List, Set and Dictionary Comprehensions

 Classes and Instances

 Modules and Module Files

 Packages and Package Directories

 "sys" and "os" Modules

 "pathlib" - Object-Oriented Filesystem Paths

 "pip" - Package Installer for Python

 SciPy.org - Python Libraries for Science

 pandas - Data Analysis and Manipulation

 Anaconda - Python Environment Manager

 Jupyter Notebook and JupyterLab

 References

 Full Version in PDF/EPUB