This article was reviewed by Luigi Oppido and by wikiHow staff writer, Nicole Levine, MFA. Luigi Oppido is the Owner and Operator of Pleasure Point Computers in Santa Cruz, California. Luigi has over 25 years of experience in general computer repair, data recovery, virus removal, and upgrades. He is also the host of the Computer Man Show! broadcasted on KSQD covering central California for over two years.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
This article has been viewed 14,787 times.
If you want to install packages from the Python Package Index on your Mac, you'll need Pip. Fortunately, if you installed Python 3.4, you should already have Pip—just run the command python3 -m pip --version to check. If you don't have Pip, there are a few different ways to install it. This wikiHow article will walk you through three simple ways to install Pip on a Mac desktop computer or MacBook.
Things You Should Know
- If you installed Python 3.4 or later, you should have Pip. If the pip command is not working, use pip3 instead.
- If Pip isn't installed, you can install it using the command python3 -m ensurepip --default-pip.
- If you didn't use Homebrew or another package manger to install Python, you can install Pip with the Get-Pip Python script.
Steps
Installing with Ensurepip
-
Open a Terminal window. If you haven't done so, you can open a Terminal from the Launchpad. The Ensurepip Python module is the most straightforward way to install Pip on both macOS and Linux.
-
Check to see if Pip is already installed. If you installed Python 3.9 or later from Python.org, by using Homebrew, or by installing the Xcode command line tools, you should already have Pip. To check, type python3 -m pip --version into your terminal and press Return.[1]
- If pip3 is not found, continue with this method to install it.
- If needed, you can update Pip to the latest version using the command python -m pip install --upgrade pip.[2]
Advertisement -
Type python3 -m ensurepip --default-pip and press ⏎ Return. If Pip was not installed, this command will install it to your current Python 3 installation. If Pip was installed, you'll see a message that says "Requirement already satisfied."
- If you only want to install Pip for the current user (not machine-wide), use the command python3 -m ensurepip --upgrade --user instead.
Installing with Homebrew
-
Open a Terminal window. If you installed Python 3.4 or later using Homebrew, you will already have Pip installed. If you don't have Python 3.4, you can install it easily with Homebrew, which will give you the latest version of Pip.
- If you want to upgrade the version of Pip you installed with Homebrew, use the command python3 -m pip install --upgrade pip.[3]
- To see which version of Pip is installed, use the command python3 -m pip --version.
-
Install Homebrew. If you haven’t already installed Homebrew, type /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" and press Return.[4]
-
Install Python3 and Pip. Installing Python also installs Pip. To install, type brew install python3 and press Return.
Installing with Get-Pip
-
Open a Terminal window. If you installed Python from source code but don't have Pip, you can use a simple script to install it.
- Don't use this method if you installed Python through Homebrew or another package manager, as the script will not interact with those tools.[5]
- You can check your current Pip version using the command python3 -m pip --version. Or, if you just want to update Pip, use the command python3 -m pip install --upgrade pip.
-
Download the script. You can use the curl command to do this. Just type curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py and press Return to save the script to the current directory.[6]
-
Type python3 get-pip.py and press ⏎ Return. This runs the downloaded script, which will then install Pip, SetupTools, and Wheel for your current Python 3 environment.
Expert Q&A
Tips
References
- ↑ https://packaging.python.org/en/latest/tutorials/installing-packages/
- ↑ https://pip.pypa.io/en/stable/installation/
- ↑ https://docs.brew.sh/Homebrew-and-Python
- ↑ https://brew.sh/
- ↑ https://packaging.python.org/en/latest/tutorials/installing-packages/#requirements-for-installing-packages
- ↑ https://github.com/pypa/get-pip