While on more modern versions of Ubuntu you could just sudo apt-get install python3-pip (and then use pip3), a Python 3 copy of pip was never packaged for 12.04. Therefore you need to follow the more old fashioned install route with easyinstall. Try: codesudo apt-get update && sudo apt-get install python3-pip /codeIf it doesn’t work, that mean you have Ubuntu 12.04 or under, pip was never packaged for these versions. So you have to intall it like that: codesudo apt-get install pyt.
Pip (Pip Installs Packages) is a package management system that allows you to install software packages written in Python. It is used to install packages listed in the Python Package Index (PyPI).
Pip is not installed on Ubuntu 18.04, Debian 9 and Linux Mint 19 by default. The installation of Pip on Ubuntu or Debian or Linux Mint is really easy.
In this post, we will see how to install Pip for Python 2 and Python 3 on Ubuntu 18.04, Debian 9 and Linux Mint 19. Apart from Pip installation, we will also see how to manage Python packages with pip.
Prerequisites
You must be logged into a system as the root user or a user with sudo privileges.
Install Pip for Python 3
Python 3 is installed by default in Ubuntu 18.04, Debian 9 and Linux Mint 19. Use the command below to verify.
Output:
The above output shows that you have Python 3 installed.
We will now install the python3-pip package using the following commands.
The above command will install pip for Python3 and its dependencies.
Once the pip installation is complete, verify the installation by checking its version.
Output:
The above output confirms that the pip for Python 3 is successfully installed. The pip version may vary depending on the operating system and the date of release.
Install pip for Python 2
By default, Python 2 is not installed in Ubuntu 18.04, Debian 9 and Linux Mint 19. If you want to install Python 2 and pip for Python 2, you can follow the below steps.
The above command will install Python and pip for Python 2 and its dependencies.
Once the pip installation is complete, verify the installation by checking its version.
Output:
The above output confirms that the pip for Python 2 is successfully installed on Ubuntu. The pip version may vary depending on the operating system and the date of release.
How to Use Pip
We will go through some basics of Pip command usage.
Replace pip3 with pip in your commands if you are using Python 2.
Install Packages Using Pip
To install a package using Pip, you can use the below command.
![Install Install](/uploads/1/2/5/2/125246512/141952262.png)
For example, to install the latest version of the package called IPython, a powerful interactive Python shell, use the below command.
This command will download all the necessary files and install the specified package.
To install a specific version of the package, you can run the below command.
List Installed Pip Packages
To list the installed packages, use the below command.
Output:
![Ubuntu install pip3 Ubuntu install pip3](/uploads/1/2/5/2/125246512/165542461.png)
Upgrade Package Using Pip
To upgrade an installed package to the latest version, use the below command.
Remove Package Using Pip
If you want to remove a package installed via pip, you can use the below command.
Search Packages using Pip
If you want to find out a package name, you can use the Pip’s search functionality. This command will get the packages list from the PyPI (Python Package Index).
Output:
Conclusion
In this post, you have seen how to install Pip on Ubuntu 18.04, Debian 9 and Linux Mint 19 and its command syntax to manage Python packages using Pip. You can visit Pip’s user guide page for more information about Pip.