Categories
Technology & Troubleshooting

How to install pip in Ubuntu or Windows Operating System?

python pip installation
Image Cedit : Click Here

According to datacamp, Pip is a recursive acronym that can stand for either “Pip Installs Packages” or “Pip Installs Python”. Pip is the most popular package management system. It helps to install software packages that have been developed in python and also discovered in Python Package Index (PyPI). Now, Before we begin to answer for how to install pip, Please match your prerequisites skills from below.

Prerequisites :

  • Basic knowledge about Linux commands
  • Basic troubleshooting skills using command-line arguments 
  • You Should have root privileges if you are going to install pip in Ubuntu. If not then type this command to enable root privileges  
$ sudo [type your command for istallation here].

by this you can easily install pip by using 'sudo' keyword before every command you type

Question and Ansewers related to pip

What is a Library in python?

A Library is a collection of packages. The packages contain multiple python files. With the help of the library, we can  use code repeatedly by importing them into our program 

Which are the different types of versions for python? 

Python comes with two different types of versions; One is Python2 which was first released in 2000.aAnother one is Python3 which was released in 2008. Python2 was deprecated from January 1st, 2020. Therefore, You must have to upgrade to Python3

Which Python version includes pip by default?

According to datacamp, Python 2.7.9(in Python2 series) and later and Python 3.4 (in Python3 series)and later include pip by default.

Which are the different types of versions for pip? 

As same as python, pip also comes with pip2(also considered as pip) and pip3. Pip 2 supports the Python2 version and pip3 supports the Python3 version.

How to check your Python version on Windows or Ubuntu?

To check which python version you are using right now in your system, type the below command on the terminal

$ python --version

OR you can type the below command for the same

$ python -V

if you will see the output after performing the above command on the terminal that means the Python is installed and working OK.

How to check the pip version on Windows or Ubuntu Environment?

To check which pip version you are using right now in your system, type the below command on the terminal

$ pip --version

OR you can type the below command for the same

$ pip -V 

To check wheather pip is installed or not in Windows OS, Type the below commands

> pip help

if you will see the output after performing the above command on the terminal that means the pip is installed and working OK. If you are getting an error like “pip: command not found”, then these steps may help you to install pip on your system.

How to update pip?

By simply typing this command in your command line terminal you can easily update the pip. This command replaces your older version of pip with a newer version of pip

$ python -m pip install --upgrade pip setuptools wheel 

How to Install pip in Ubuntu 20.04 using the “apt-get” command

How to install pip in ubuntu 20.04
Image Credit : Click here
  • Open up  the terminal and type the below command in Command Prompt:
$ sudo apt-get update   or $ sudo apt update   

The above command updates all the pre installed packages in your system
$ sudo apt-get upgrade

The above command upgrade all the pre-installed packages in your system
$ sudo apt install python3-pip 

This above command is for the version of python3 if you are using Python2 then type the below command

$ sudo apt install python-pip
$ pip --version

OR, Type 

$ pip -V

To check the pip is installed sucesfully or not with its version conformation.

This will help you out with the installation of the pip package manager using the apt-get command 

How to install pip in Ubuntu 20.04 using the cURL (a client-side data transfer tool) command

To install pip using the curl command, you have to type the command given below.

$ curl https://bootstrap.pypa.io/get-pip.py | python

In addition to this command, it is suitable to upgrade the pip installed version using the command mentioned earlier in this blog. To know more please visit most recommended video

How to install pip in Windows 10 Operating Systems.

How to install pip in windows 10
Image Credit : Click Here

Before going to configure pip in your windows os, kindly make sure that your system has python in it. To check python installation in Windows OS, type the below command in the terminal window

> python

If the above command obtain an output like this, 

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
 Type "help", "copyright", "credits" or "license" for more information.

Then it means Python is installed in Windows OS and working properly. Otherwise, if it gives this type of output like

Python is not recognized as an internal or external command, operable program or batch file. 

Then you first have to install Python in your system and then you can make installation of pip in your system.

Now to install Python in Windows OS kindly follow these instructions.

  • Download stable version of get-pip.py to a folder on your system
  • Open a terminal and navigate to the folder path containing the get-pip.py installer.
  • Run the below using command-line tools on your command prompt
> python get-pip.py
  • Check the configuration using the below command 
> pip -V

It gives you a python-pip version as an output
  • Finally, Upgrade the pip using the below command.
> python -m pip install --upgrade pip

To know more please visit most recomanded video

Setup your Virtual Environment (VE) using pip:

While working with different projects, we need separate package installation for each. This is a serious issue for developers who are new in this area. Python comes with the venv and virtualenv for the sake of the solution. You can manage a separate package by configuring the venv to your system.

  • Installing Virtual Environment:

On macOS & Linux :

$ python3 -m pip install --user virtualenv

On Windows :

$ py -m pip install --user virtualenv
  • Creating Virtual Environment :

On macOS & Linux :

$ python3 -m venv env

Here note that the env is your virtual envrionment name, you can give it by your own.

On Windows : 

$ py -m venv env 

Here note that the env is your virtaul environment name, you can give it by your own. 
  • Activating Virtual Environment :

On macOS and Linux: 

Before using your created environment you need to active it first by typing,

$ source /env/bin/activate

On Windows: 

Before using your created environment you need to active it first by typing,

>.\env\Scripts\activate
  • Check and Confirm Virtual Environment :

On macOS and Linux: 

$ which python

The output shows the env path

On Windows: 

$ where python

The output shows the env path
  • Deactivate Virtual Environment :

On macOS and Linux: 

$ deactivate

You see removal of your env name from the command prompt and get you out

On Windows: 

$ deactivate

You see removal of your env name from the command prompt and get you out 

It is suggested to use Anaconda-Navigator for a better experience of programming python. For installing anaconda in ubuntu click here

Reference : 

Ask UbuntuLinuxizepython official website

Leave a Reply

Your email address will not be published. Required fields are marked *