List of content you will read in this article:
Pip is a great tool for installing and managing Python packages; it is a package manager that allows the installation of third-party software packages for Python. It is among the most powerful package managers for Python and has become quite popular because it is quite easy to use. Even though most Python versions come pre-loaded with it, this guide will teach you to manually install pip, review its version, and use some simple pip commands. It is a preinstall package with python to only update or package versions. It does not play any role in the installation or uninstallation of Python.
What is Python? [Definition]
Python is an open-source programming language that allows software development and even makes a great choice for web development. Also, one can use Python on several popular operating systems, including Windows, Linux, and iOS.
How to Upgrade pip in Windows/Linux?
To take advantage of the new features and security patches, update pip from time to time, just like any other software. While pip can automatically update itself, you need to know how to update pip on windows and Linux VPS manually. Follow the below steps to update pip.
Step 1: Simply open Command Prompt on the Windows system or terminal in Linux.
For Windows: First, enter Windows+R and type CMD and enter, or you can open the Windows search box, then type command prompt and enter button.
For Mac: press command + space key, type terminal, and hit the enter button.
For Linux: just log in to ssh with putty or any other terminal software.
Step 2: Execute the following command:
python -m pip install --upgrade pip
This will uninstall the current version of pip on the system and replace it with the latest version.
How to Downgrade pip?
If one needs to revert to a previous version of pip due to compatibility issues, one can easily do it from the Command Prompt. Open a command prompt and type the following command to downgrade to a custom version of pip (specify the version of pip).
python -m pip install pip==18.0 (or any other version)
Pip will be downgraded to the specified version. After the execution of the above command, one can check the pip version with this command: pip3 --version.
How to install Python packages with pip?
With pip, we can install any new package for our Python environment. To install a new third-party package using pip, we can use the pip install <package name> command. And pip will install the new packages from the PyPI repository.
Let’s say if you want to install NumPy for your Python environment, you can run the following pip install command.
$ pip3 install numpy
$ pip install numpy
How to update Python packages with pip?
After installing the package, later, if we wish to update the package to the latest version. For that also we can take the help of pip command.
With pip3 install --upgrade <package name> command, we can upgrade the installed python package to the latest available version.
For example, let’s say we want to upgrade the installed NumPy package to its latest version.
$ pip3 install --upgrade numpy
$ pip install --upgrade numpy
How to uninstall Python packages with pip?
We can also uninstall an installed python package using the pip command. The pip command makes it very easy for the developer to manage the third-party packages. For some reason, if you do not want a specific package for your Python environment, there you can use the following pip command to uninstall the package.
pip3 uninstall <package_name>
Let’s say now you do not need the installed NumPy package and wish to uninstall it. For that, you can run the following command on your terminal or command prompt.
pip3 uninstall numpy
pip uninstall <package_name>
How to Install PIP [Step-by-Step Guide to Upgrade PIP Packages]
Here are some simple steps that guide you to installing pip on the system:
Step 1: Install Python and pip
To install pip for your system, you first need to install Python3. And to install Python, you can visit the official website of Python(recommended for windows and mac). If you are on windows and mac, with the latest installation of Python, pip will also get pre-installed.
If you are a Linux user, you can install the latest version of Python and pip from the terminal only rather than installing Python from its official site.
Linux installs Python and pip (with sudo access).
$ sudo apt update
$sudo apt install python3 python3-pip
The above two commands will install Python for your Linux system.
Step 2: Check the pip Version and Verify the Installation
To check if pip is installed correctly, run the following command in the command prompt (for Windows) or Terminal (for Linux and macOS):
You will get an output similar to the one shown below:
pip18.0 from c:\users\administrator\appdata\local\programs\python\python37\lib\site-package\pip (python 3.7)
Step 3: Managing Python Packages with pip
Use pip to handle functionalities once it's installed and configured in the system. To get a quick overview of the functions and syntax available for Pip, open a command prompt and type:
If you have an older version of Python already installed in your operating system, then you can check out our blog on how to update python for a deeper understanding of how to install pip in windows/Linux, This blog post will help you.
We hope we have successfully made you understand how to install pip on your system. If you are working with Python development, pip can come in handy for managing various python library packages. Also, you can easily choose a pip version that you want to work with.
People Are Also Reading: