How to Install pip on mac OS or OS X ?
How to Install pip on mac OS : You are a Mac user and want to install pip to install python libraries? Then this tutorial is for you. I’ll show you how to install it on MacOS in the easiest way possible.
Python Install Pip On MacOS?
Python is one of the most popular programming languages. To fully use its power it is necessary to install third party libraries that are not present in the base version installed by default. To install these libraries, the most commonly used method is the PIP command. PIP is a package manager used to install and manage packages written in the Python language. Many packages are located in directories on the Python Package Index (Pypi) repository. One of the major advantages of pip is the ease of its command-line interface.
Check Python Version
By default MacOS comes with a version of Python. To verify that a version of Python is installed directly on your Mac, open the terminal and execute the following command:
If the command returns a version number then you do have python to install. For other cases, I invite you to install python by following this video tutorial :
Install Pip with get-pip.py On MacOS
This python file get-pip.py is a script that will download and install the Pip package for the Python language. The first step is to download the get-pip.py script using the curl command ( if you want more details about this command, please read the article I wrote about this command). Execute the following command to get the script :
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
The -o option is used to define the name of the downloaded file.
Once the script is downloaded, simply execute the script using Python :
Check Pip Version
To check that Pip is properly installed, just type the following command in the terminal :
Note : It is also possible to use the –version option instead of -V
Install Pip with brew On MacOS
There is a second method to install Pip using Homebrew. Homebrew is a package management tool available for macOS. To use it, just type the following command:
brew install python
Before 2019 it was possible to use easy_install (setuptools module). But since then it is not recommended to use this method to install Pip.
Check this link for more information :
Install packages with Pip on MacOS
Once you have installed Pip, you will be able to install the packages you are interested in with the following command :
packageName is the name of the package you want to install.
Upgrade Pip on MacOS
To update the version of Pip, you can use this command :
pip install -U pip
- Install Pip with get-pip.py : use the curl command to download the file to install Pip
- Install Pip with brew : Homebrew is the packet manager of macOS
- easy_install has been deprecated : Do not use this method
I hope this tutorial allowed you to install Pip in your Mac. Feel free to ask me your questions in comments, I would be happy to answer them! 🙂
Amazon MacBook PRO (Affiliate)
If you want to get the new MacBook Pro to work in good conditions (As an Amazon Partner, I make a profit on qualifying purchases) :
Leave a comment