If you’re a developer using a laptop running Linux or one of the other popular Linux distributions like Ubuntu, there’s no doubt you’re going to eventually need to use Pip Installs Packages, known as Pip for short. Pip is the package manager for Python, and you’ll need it to install, search for, and deal with the Python Package index to help them work right. You might need to use Pip as a regular user to install an app that was developed using Python. Here’s how to do it.
How to install Pip on Ubuntu
In most cases, you shouldn’t need to install Pip separately from Python on Ubuntu since both are pre-installed. If you find yourself in a situation like that, you should instead reinstall Pip entirely, which is what this guide covers as a fallback situation. As with most of these tasks, you must install Pip with the terminal. To do this, fire up a terminal session with Ctrl + Alt + T. Once open, you can dive into the steps below.
Python 2 and Pip 2 are deprecated in favor of Python 3 and Pip 3. We suggest staying away from it, even though you can still use it. This guide will not cover the legacy version of Pip.
- Type the following command to check for Python 3: python3 –version
- If you don’t see a number, then you’ll need to install Python with the command: sudo apt install python3 -y.
- If you see a number but Pip still doesn’t work, you can use the command sudo apt purge python3 to completely remove Python 3 from your machine. You can then run sudo apt install python3 -y.
- If reinstalling Python 3 didn’t fix Pip, you can try to install it with the command: sudo apt install python3-pip -y
- Verify that it is installed with the command: pip3 –version
If successful, you should see a readout like the one above. With Pip installed, we do have some tips and tricks for you to keep in mind in the next section.
How to use Pip on Ubuntu
To use Pip on Ubuntu, you’ll again need to be in the terminal. There are several commands to take note of. We’ve highlighted several of them for you below.
- pip3 –help: This command is used to list all possible commands with Pip. It’s a great starting place for beginners.
- pip3 install: This command is used to install packages. You can install a package by simply entering its name like pip3 install scrapy
- pip3 list: This command is used to list out any installed packages on your system
- pip3 install –upgrade package_name: This command is used to update an installed Python package. Just replace package_name with the name of the package.
The above commands are the basics, but there are several others you might want to keep in mind. Just as examples, pip3 show package_name will show information about a specific package. And more obviously, pip3 uninstall package-name will remove a package from your system.
Just one more thing
That’s pretty much all there is to using Pip on Ubuntu. As a reminder, if you’re looking for specific packages, you can head over to the official Python Package Index website and download what you’re looking for. Though Pip is one thing to use, it’s also a good idea to check out how you install VS Code or Java as well. Just like Windows and macOS, Ubuntu is a great operating system for developers.
** (Disclaimer: This video content is intended for educational and informational purposes only) **
More...