Install PIP on Ubuntu 18.04

PIP stands for Python Package Index (PyPI) used for installation and management of software packages in Python. PIP makes it very easier to install packages in Python. Now you are going to install PIP on Ubuntu 18.04 and you will also learn some basic commands in PIP.

Prerequisites

Before you start to install PIP on Ubuntu 18.04. You must have non root user account on your server with sudo privileges.

Before You Begin

By default Python 3 is installed in Ubuntu 18.04 but if you have made any changes then you can check version of python by entering following

    python --version
    Output:
        Python 3.6

1. Install PIP for Python 3

Before start installing PIP on Ubuntu, you should update package index by entering following.

sudo apt update

Now to install PIP on Ubuntu enter following command

sudo apt install python3-pip

To confirm installation and check version of PIP enter following command

pip3 --version

Output should be :

Output:
    pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

If output comes as above then you have successfully installed PIP on Ubuntu .

NOTE – version number of PIP may change with time.

2. Install PIP For Python 2

Update the package manager index by entering following command

sudo apt update

After updating package manager index to install PIP for Python 2 enter following in terminal

sudo apt install python-pip

Check version and confirm installation by entering following

pip --version

Output should be :

Output
    pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

3. Basic usage of PIP for python 3

To list all the commands in PIP enter following

pip3 --help

Get information of specific command enter following

pip3 install --help

To search package with PIP enter following

pip3 search PACKAGE_NAME

Install package with PIP enter following in terminal

pip3 install PACKAGE_NAME

To install package from requirements file

pip3 install -r requirements.txt

Upgrade package with PIP

pip3 install --upgrade PACKAGE_NAME

Uninstall package with PIP

pip3 uninstall PACKAGE_NAME

4. Basic usage of PIP for python 2

To list all the commands in PIP enter following

pip --help

Get information of specific command enter following

pip install --help

To search package with PIP enter following

pip search PACKAGE_NAME

Install package with PIP enter following in terminal

pip install PACKAGE_NAME

To install package from requirements file

pip install -r requirements.txt

Upgrade package with PIP

pip install --upgrade PACKAGE_NAME

Uninstall package with PIP

pip uninstall PACKAGE_NAME

Conclusion

Here you have learnt how to install PIP on Ubuntu 18.04 for python 3 and python 2. If you have any queries regarding this please don’t forget to comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>