PIP is a recursive acronym that stands for “PIP Installs Python” (Confusing, right ?). PIP is basically a package manager to manage python-based applications & packages. PIP is used to install, remove or upgrade many of the python packages available in a repository known as Python Package Index or PyPI, in short.
Recommended Read: How to install JAVA on Ubuntu
Think PIP as YUM or APT for Python packages. In this tutorial, we will learn to install PIP on Ubuntu machines. Let’s discuss pre-requisites first,
We should have Python installed on our system, which most of the Linux systems already have installed by default. But we can install python on Ubuntu with the following command as well,
$ sudo apt-get install python
You can also refer to our detailed tutorial here for python installation. Now next step would be to discuss how to install PIP on Ubuntu.
Install PIP on Ubuntu
We can either of the two below mentioned methods to install PIP on Ubuntu. We can either install PIP using a script or we can install PIP package available in the default Ubuntu repositories.
Install using script
There is an official script that we can use to install PIP on Ubuntu, we just need to download it & run it on our system,
$ curl “https://bootstrap.pypa.io/get-pip.py” -o “get-pip.py”
$ python get-pip.py
Upon completion of our script, we would have PIP installed on our system.
Install using the Ubuntu repository
This is the easiest method that we can use to install PIP on Ubuntu, we just need run the following commands,
$ sudo apt-get update && sudo apt-get upgrade -y
$ sudo apt-get install python-pip
Once PIP is installed, we can use it to manage packages. Let’s discuss some commands for using Python PIP.
To install a package using PIP, use the following command,
$ pip install package_name
To install a number of packages, we can create a file & mention all the packages we need to have to install ed on our system. Then run the following command to install all the packages,
$ pip install -r packages.txt
To remove a package, run
$ pip uninstall package_name
Command to only download a package & not install it is,
$ pip download package_name
To list installed packages,
$ pip list
For a complete list of options that can be used with PIP command, run
$ pip –help
That’s it for this tutorial on how to install PIP on Ubuntu. Please feel free to send in any questions or queries using the comment box below.