How to Install pip on MacOS or OS X?
There are different ways to install pip on MacOS or OS X:
- 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.
- 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
- 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.