How to install pip on Linux

Question: I want to use pip to install Python packages. However, when I run pip, it says "pip: command not found". How can I install pip on [insert your Linux distro]?

There are various ways to install and manage Python packages. One of the easiest way is to use pip command line tool. Using pip, you can install/update/uninstall a Python package, as well as list all installed (or outdated) packages from the command line.

To install pip on Ubuntu, Debian or Linux Mint:

$ sudo apt-get install python-pip

To install pip on Fedora:

$ sudo yum install python-pip

To install pip on CentOS, first enable EPEL repository, and then run:

$ sudo yum install python-pip

To install pip on Archlinux:

$ sudo pacman -S python-pip

If you want to install pip3 for python3, you can use the following commands.

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

4 thoughts on “How to install pip on Linux

  1. I have multiple Pythons on Ubuntu 12.04.5 server. The default is 2.7 and listens to the command python. then there is a second one trigered by the command python3, which is version 3.2.3. I installed now version 3.3.6, but the only way to activate it is by using the command /opt/python3.3/bin/python3 (I used ./configure --prefix=/opt/python3.3) .

    In the /usr/bin I created ln -s /opt/python3.3/bin/python3 python3.3. So whenever I run python, i get 2,7, python3 give me 3.2.3 and python3.3 gives me 3.3.6.

    Next I installed pip according to your instructions : apt-get install python-pip

    Looks like pip is installed under /usr/local/bin/pip. But when running the command "pip3 install --upgrade --pre acdcli" I get "command not found". So I did "cp pip pip3.3 and edited the first line to #!/usr/bin/python3.3 .

    I was also asked to install pkg-resources, so I did apt-get install python3-pkg-resources. When I run the pip3.3 command like this: pip3.3 install --upgrade --pre acdcli I get

    Traceback (most recent call last):
    File "usr/local/bin/pip3.3", line 5, in
    from pkg_resources import load_entry_point
    ImportError: No module named 'pkg_resources'

    The python3.3.6 is installed according to this setup: http://askubuntu.com/questions/244544/how-do-i-install-python-3-3.

    What am I missing here ?? Any advice is welcome. Many thanks in advance 🙂

Leave a comment

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