• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Pip on Ubuntu 20.04

Written by Admin, Updated On April 28, 2020
pip, python, ubuntu
How to Install Python Pip on Ubuntu 20.04

Pip is a package management tool used for installation of packages in Python. Using pip, you can search, download and install packages from Python Package Index (PyPI) and other repositories. In this tutorial, described how to install Pip on Ubuntu 20.04 Focal Fossa.

Install PIP for Python 3#

Perform the following steps as root or user with sudo privileges to install Pip for Python 3 on Ubuntu 20.04 system:

At first, you should update the package list using below command:

sudo apt update
sudo apt install python3-pip

Above command will install pip and required dependencies. Verify the installation by checking the pip version:

pip3 --version

Version number of Pip may be changed. It will show output as below:

pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

Installing pip for Python 2#

By default, Ubuntu 20.04 repositories does not include Pip for Python 2. We will install pip for Python 2 using the get-pip.py script. Run below command to enable the universe repository:

sudo add-apt-repository universe

Update the packages index and install Python 2:

sudo apt update
sudo apt install python2

Download the get-pip.py script using curl command:

curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py

After enabling the repository run script to install pip for Python 2:

sudo python2 get-pip.py

Above we used sudo to install Pip globally. It also installs setuptools and wheel which allow you to install source distributions.

To verify the pip version number, type:

pip2 --version

Output should as:

pip 20.0.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

Use of PIP for Python 3#

Here, we will see some useful basic pip commands. First of all to get the list of all the commands in PIP issue below command:

pip3 --help

If you want to get information for particular command then issue command as below:

pip install --help

Above command will give details about install command.

To search package using PIP just type as below:

pip3 search PACKAGE_NAME

You should replace PACKAGE_NAME with the name of package which you want to search.

Install Package Using Pip#

Below is the syntax to install package with PIP:

pip3 install PACKAGE_NAME

Same as search replace the PACKAGE_NAME with package name.

Install Packages Using Requirements File#

You can install packages using requirements file. requirement.txt is a text file that contains a list of pip packages with their versions which are required to run a specific Python project. Use below command to install a list of requirements specified in a file:

pip3 install -r requirements.txt

Upgrade a Package With Pip#

You can upgrade already installed packages to latest version using below command:

pip3 install --upgrade PACKAGE_NAME

Uninstalling Packages With Pip#

To uninstall package with pip issue command:

pip3 uninstall PACKAGE_NAME

Conclusion#

This tutorial shown you how to install Pip on Ubuntu 20.04 for Python 3 and Python 2. Also described how to manage Python packages using pip. You can get more details about pip from this guide.

If you have any question or suggestion leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install WordPress with Apache on CentOS 8
Next Article   How to Install Jenkins on CentOS 8

Related Posts

  • How to Install Apache, MySQL, PHP (LAMP) on Ubuntu 22.04

    How to Install LAMP on Ubuntu 22.04

    March 20, 2023
  • How to Install LEMP Stack on Ubuntu 22.04

    How to Install LEMP Stack on Ubuntu 22.04

    March 18, 2023
  • How to Install Memcached on Ubuntu 22.04

    How to Install Memcached on Ubuntu 22.04

    March 16, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook