Python: Install Pip – MacOS, Ubuntu, CentOS

What is Pip? pip is a tool for installing and managing Python packages.

As well as Python, pip can be install on various operation systems: Linux, Mac, Windows, etc.

In this post i am showing how to install pip on MacOS and how to install pip on Linux (Ubuntu and CentOS).

Cool Tip: How to install specific version of a package using pip! Read More →

Python: Install Pip

To install the latest version of pip, run the below commands depending on your OS.

Install Pip on MacOS

Install pip on MacOS, using easy_install command and upgrade pip to the latest version:

$ sudo easy_install pip
$ sudo pip install --upgrade pip

Install Pip in Ubuntu

Install pip in Ubuntu, using apt-get package manager:

$ sudo apt-get update
$ sudo apt-get install python-pip
$ sudo pip install --upgrade pip

Install Pip in CentOS

Install pip in CentOS from EPEL repository, using yum package manager:

$ sudo yum update
$ sudo yum install epel-release
$ sudo yum install python-pip
# CentOS-7 and higher
$ sudo pip install --upgrade pip
# CentOS-6 (the last stable version of PIP that is compatible with Python 2.6)
$ sudo pip install pip==9.0.3

7 Replies to “Python: Install Pip – MacOS, Ubuntu, CentOS”

  1. Jean-Guillaume Lamagnere says: Reply

    Hi, I am a mac user and tried to install pip using the easy_install pip command and I got this message on my terminal :

    error: can’t create or remove files in install directory

    The following error occurred while trying to add or remove files in the
    installation directory:
    [Errno 13] Permission denied: ‘/Library/Python/2.7/site-packages/test-easy-install-59336.pth’
    The installation directory you specified (via –install-dir, –prefix, or
    the distutils default setting) was:
    /Library/Python/2.7/site-packages/
    Perhaps your account does not have write access to this directory? If the
    installation directory is a system-owned directory, you may need to sign in
    as the administrator or “root” account. If you do not have administrative
    access to this machine, you may wish to choose a different installation
    directory, preferably one that is listed in your PYTHONPATH environment
    variable.
    For information on other options, you may wish to consult the
    documentation at:
    https://pythonhosted.org/setuptools/easy_install.html
    Please make the appropriate changes for your system and try again.

    I am the main and only user of my mac, so I don’t really know why they mention the root account.
    Have you ever come across or heard about this type of problem before ? Would be a huge help if you had any tiny information about that.
    Thanks a lot!

    Jean-Guillaume

    1. Abu Abdirohman says: Reply

      I think you forgot include “sudo” in your type

  2. frederic payet says: Reply

    For macOS High Sierra, I have to manually install the latest python package and use the pip3 command instead.

  3. hey tried this as well..now it is asking me the password!!!!!
    what to do??

    1. You need to use the password for your computer to install.

  4. Thanks it worked

  5. Jordi Grifell Ros says: Reply

    THIS IS WHAT MY CONSOLE RETURNS…ANY HELP? THANK YOU!!:
    Searching for pip
    Reading https://pypi.python.org/simple/pip/
    Download error on https://pypi.python.org/simple/pip/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) — Some packages may not be found!
    Couldn’t find index page for ‘pip’ (maybe misspelled?)
    Scanning index of all packages (this may take a while)
    Reading https://pypi.python.org/simple/
    Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) — Some packages may not be found!
    No local packages or download links found for pip
    error: Could not find suitable distribution for Requirement.parse(‘pip’)

Leave a Reply