How to install Python PIP on Mac

What is PIP

PIP (stands for PIP Installs Packages) is a command line utility to manage (ex. install, uninstall, etc) Python packages. Depending on which Python version, you may or may not have it installed. Newer versions of Python already ship with PIP. If you do not have it installed, follow the steps below…

Check if PIP is installed

  • Open a terminal and type

if you have it installed, you should get something like…

  • You can also type

If you have it installed, you should get something like…

If PIP is not installed then continue…

Install PIP using easy_install

Python comes with easy_install. To check if it is installed type

You should get something like

If easy_install is not found, you can install it as follows…

Now run the following…

You should now have PIP installed. Note that if the above method does not work, you can install PIP using get-pip.py…

Install PIP using get-pip.py

Download get-pip

Run get-pip

Install PIP by installing Python

You can install the latest version of Python on Mac as follows…

Once the installation is complete, you should have pip installed. If you encounter problems after installation, you may need to Google brew unlink and brew link to fix any linking issues.

Python Virtualenv

Having multiple versions of Python (ex. 2.x, 3.x) and Python packages may cause conflicts and confusion. A better way to manage that is to install Python virtual environment. To do that follow the steps below…

Assuming we have Python 3.x, run the following command to install Python Virtualenv…

Make virtualenv directory…

Create a virtual environment for Python 3.x

Activate the virtual environment

To install any packages targeting the newly created virtual environment, here is an example…

Note that pip in the above command points to the virtual environment pip command and the requirements file is just a text file containing the Python packages you want to install. You can provide a list of package names instead of a text file if you wish. If you type

you should get something like

That is all for today. I hope this article was useful. Thanks for visiting. Please use the comments section below for feedback and questions.

Tags:,

Add a Comment

Your email address will not be published. Required fields are marked *