Preferred Installer Program or PIP is standard Python package manager to manage Python packages and libraries. This tutorial is a guide on how to install Python PIP on a Mac. Before we install PIP, let’s understand Python.
Python is a well-known, widely used, high-level, general purpose programming language primarily used to develop websites, applications, and data management. It supports various packages which are managed by the PIP package management system and how this system manages the packages; let’s find out:
PIP Package Management System
To enhance the functionality of the Python programming, packages play a significant role. These Python packages are stored in a repository which is known as Python Package Index or PyPl. PIP package manager uses this repository as a source to download and install the Python packages. More than 350,000 packages can be accessed from Python Package Index – PyPl.
Prerequisites to Install PIP on Mac
To install PIP on a Mac following prerequisites are needed:
- MacBook or a system with macOS
- User with admin privileges
Note: Usually PIP gets automatically installed if you install the latest version of Python. If it is not installed, then the methods mentioned in the next section can be used:
How to Install Python PIP on Mac
There are multiple methods to install PIP on macOS. This guide will cover 4 different methods to install PIP on macOS.
1: Installing PIP on Mac Using get-pip.py Script
First open terminal on your Mac by pressing Command + Space Bar keys, search terminal and then hit Enter to open it:
Most importantly; verify if Python is installed or not on your Mac. Use the command given below to check the Python version:
The output shows that the Python version 3.10.7 is installed.
Now, execute the following command to download the get-pip.py script in current working directory:
To check if the file is downloaded or not use the following command:
To install PIP, run the script using command:
2: Installing PIP on Mac Using brew
PIP can also be installed using an open-source package manager for Mac; Homebrew. Before proceeding with this method you need to have Homebrew installed on your system and to install Homebrew on Mac execute the command given below in the terminal:
After installing Homebrew update it:
Now, use the following command to install the Python and PIP:
The above command will also install the setuptools which are used to package Python projects.
3: Installing PIP on a Mac Using ensurepip
The ensurepip package comes with Python installation and helps in installing PIP. Use the command given-below to manually install PIP using ensurepip:
4: Installing PIP on a Mac using Standalone Zip Application
PIP is also available in standalone zip application format, to download the application use the following command:
Now use any version of Python to execute the application:
To install any package using the standalone app use the following syntax:
For example, to install NumPy:
How to Check PIP Version on Mac
To check PIP version on macOS use the below-mentioned command in the terminal:
How to Update PIP on Mac
To keep the PIP package manager up to date, use the command mentioned below:
How to Install a Specific PIP Version on Mac
The command to install the specific PIP version follow the below-mentioned syntax:
For example, to install the PIP version 21.0 use:
How to Uninstall a Specific PIP Version from Mac
To uninstall a specific PIP version on a Mac use the following command:
To install the PIP version 21.0 use:
PIP is a Python package manager used to install, delete Python packages. Python supports many packages which adds to its functionality. PIP gets automatically installed while installing the latest Python. But if you want to install manually or want a specific version of PIP then 4 different methods are explained in this guide.