How to Install Python on macOS

Python, with its clarity and versatility, has gained prominence as one of the go-to languages for various programming endeavors. From web development to data science, Python has vast applications. In this guide, we will show you how to install the latest version of Python on a Mac machine.

1. Check Existing Python Version

macOS comes with Python 2.7 pre-installed by default. To check the installed version, open Terminal, and type:

python --version

If you see a version starting with '2.x', then Python 2 is installed.

2. Download the Python Installer for macOS

- Visit the official Python downloads page: Python Downloads for macOS.
- Click on the latest Python release. Always choose the most recent stable version.
- Under the Downloads section, click on the macOS installer package to start the download.

3. Run the Python Installer

- Navigate to your download location and double-click the installer package (usually a .pkg file).
- Follow the on-screen instructions to install Python.

4. Verify the Installation

- Once the installation is complete, open Terminal.
- Type:

python3 --version

This command should display the Python version you installed.

5. Using Python 3

To use Python 3, you will typically use the 'python3' command in the Terminal. For example, to launch the Python 3 interpreter, simply type:

python3

6. (Optional) Install pip (Python Package Installer)

Modern Python installations on macOS come with 'pip' pre-installed. Pip is a package management system to install and manage additional Python libraries. To check if 'pip' is installed, type:

pip3 --version

Conclusion

You've now successfully installed Python on macOS. You're all set to start your Python development journey on your Mac!


Comments