How to Install pip on MacOS or OS X?

python

There are different ways to install pip on MacOS or OS X:

  1. Install pip using the built-in package manager, Homebrew. Open your terminal and type:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Follow the prompts to install Homebrew, then type:

$ brew install python

This installs Python 3 and pip.

  1. If you have Python 2.7.9 or later or Python 3.4 or later, pip should already be installed. To check, open your terminal and type:
$ pip --version

If pip is not installed, install it using:

$ sudo easy_install pip
  1. You can also install pip using the get-pip.py script. Download the script from the official pip website using the following command:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Then, run the script using the Python interpreter:

$ sudo python get-pip.py

This installs the latest version of pip.

After installation, you can use pip to install various Python packages and libraries.

Latest Questions

python How to Fix ""zsh: command not found: python" Error on MacOS X? python How to Fix "xlrd.biffh.XLRDError: Excel xlsx file; not supported" Error in Pandas? python How to Remove All Whitespace From a Python String?