×

How to Install PIP In Python

How to Install PIP In Python

The libraries for Python have made our work easier than we expected. From a simple addition of two numbers to applying algorithms on the big datasets. There's nothing left that is not possible with its aid.

Installing packages is not a big deal when you have pip installed in your system.

Today, we will deep dive into the steps that we have to follow while installing pip in python.

Let’s first understand what pip is?

The first question that comes to the mind of every python developer is "What pip stands for?"

The answer to this is, pip stands for “PIP Installs Packages” or “Preferred Installer Program”.

Simply writing the pip command in the command prompt can help us to download & manage packages. In a nutshell, we can say that it is a standard package manager.

Packages contain all the necessary files for a module and modules are the in-built codes that can be used directly in our python projects.

We’ll look at the methods that are used to install this in Windows, MAC & Linux.

Let’s begin!

  1. Installing pip in python (Windows)
  2. First of all, to check the version of python installed on our PCs, we will type the python –version in the command prompt.
  3. If you have Python 2.7(or greater) or Python 3.4(or greater) you need not install pip because it is present by default in these versions.
  4. Download the get-pip.py installer script and save it with the extension .py
  5. The next step is to open the command prompt and run the command

get-pip.py

  • Now this pip is installed successfully in your system.
  • We can check the version of the pip using the pip –version.
  • Installing pip in python(macOS)

macOS is the most renowned and used operating system among the techno-savvy generation. It has got all the features that every geek looks forward to. So, the steps for installing pip are-

  • Open the terminal in macOS.
  • Type the given command-

sudo easy_install pip

  • Installing pip in python (Linux)

Linux has a great variety of commands. Since it follows the shell scripting way of interaction, the OS understands our tasks through commands. In Linux, the commands for installing pip vary with the version of Python.

We will look at some of them here-

First, we will see how to install pip in Python31d2X4CK

sudo apt update

sudo apt install python-3 pip

We can check its version after the successful installation

pip3 --version

Now let’s have a look at how to install pip in Python2

  1. We will install pip using get-pip.py.
  2. The next step here is to enable the repository which can be done using the command-

sudo add-apt-repository universe

  • Now we will update the packages-

sudo apt update

sudo apt install python2

  • Now it’s time to use the curl command for downloading the get-pip.py script.
  • We can run the script with-

sudo python2 get-pip.py

  • The version of a pip can be checked after its installation using the command-

pip2 –version

Pip Commands

  1. install    -         It installs the packages.
  2. download  -     It downloads the packages.
  3. uninstall   -     It uninstalls the packages.
  4. freeze    -        It output the installed packages in requirements format.
  5. list        -         It lists the installed packages.
  6. show    -         It shows information about the installed packages.
  7. check   -        It verifies the installed packages that have compatible dependencies.
  8. config -           It manages the local and global configuration.
  9. search -          It searches the PyPI for packages.
  10. wheel  -          It builds wheels from our requirements.
  11. hash    -         It computes hashes of package archives.
  12. completion       -       A helper command is used for command completion.
  13. help     -                   It shows help for commands.

What are the General Options:

  1. -h, --help   -               It shows help.
  • --isolated   -              It runs pip in an isolated mode, ignoring environment variables and user configuration.
  • -v, --verbose   -           It gives more output and can be used up to 3 times.
  • -V, --version   -            It shows version and exit.
  • -q, --quiet        -         It gives less output and can be used up to 3 times (corresponding to warning, error, and critical logging levels).

So, in this article, we looked at the installation of pip in different operating systems such as Windows, macOS, and Linux.

Python has a plethora of libraries that can be accessed using pip. Since now you have learned how to install pip, you can come up with some great projects.


Related Topics

How to create a DataFrames in Python

How to create a DataFrames in Python Data Frame is a data structure in which data is stored in tabular form. They can also be referred as two-dimensional collection of data. Various...

5 minutes read.

Python Examples

In this tutorial, we will see some examples related to python. This will include some basic example questions and their code in Python. Write a program to print “Hello Python”. print(‘Hello Python’) Output Hello...

5 minutes read.

Captcha Code in Python with Example

Python Programming Language Python programming language is one of the most used programming languages, as it is used widely in the field of software and data analysis, web development, etc. It...

6 minutes read.

Python String ljust() method

Python String ljust() method The string.ljust() method in Python will left align the string, where the padding is done using the parameter fillchar (space is default). Syntax String.ljust(width[, fillchar]) Parameter width: This parameter represents the...

2 minutes read.

Syntax of Map function in Python

In this tutorial, we will understand what the map function in Python is meant. Further, we will see the syntax to be used for the same in python language. We...

3 minutes read.

Python id() function

Python id() function The id() function in Python returns an id for the specified object where all the objects in has its own unique id. Syntax id(object) Parameter object: This parameter represents any object, String, Number, List,...

1 minute read.

Word frequency Python

Word frequency Python In this tutorial, we will write the Python program to count the occurrence of a word (word frequency) in a given sentence. We will learn all the approaches...

5 minutes read.

Python math.cos and math.acos function

Math.cos() function In Python, the Math module is used for performing the mathematical operations. It includes the math.cos() function that is used for obtaining the cosine value of an angle in...

3 minutes read.

Python Comment Block

In this tutorial, we will see what comment blocks mean in Python. Further, we will see the commenting methods supported in Python. We will understand the topics deeply with the...

6 minutes read.

Count Number of Keys in Dictionary Python

Dictionary is a particular data type in python. Dictionary stores unique values by taking different keys and their assigned values. Through this article, we will learn about python dictionary count,...

3 minutes read.

Attributes in python

In this article, we shall learn about attributes in python. Classes are a mix of data and functions, which in reality mean attributes and methods respectively. Typically, the body of a...

3 minutes read.

Python program to check whether a given number is prime or not

Python program to check whether a given number is prime or not A positive integer greater than 1 is called a prime number if it is divisible by one and number...

1 minute read.

Recursive Multiplication Python

Recursive Multiplication Python In this tutorial, we will learn how to write a Python program to get the multiplication of two numbers using the recursive approach. In the recursive multiplication approach, we...

2 minutes read.

Important Difference between Python 2.x and Python 3.x with Example

The comparison between Python 2 and Python 3 is given in the article that follows. Python is a computer language that can perform more tasks than other languages and is...

5 minutes read.

Cube Root in Python

In general, the cube is a three-dimensional solid figure that has 6 square faces. It is also called a geometrical shape with six equal faces, eight vertices, and twelve edges....

3 minutes read.

Uint8 Python

Python: Python programming language is one of the most used programming languages, as it is used widely in the field of software and data analysis, web development, etc. It is said...

3 minutes read.

Python Pickle

The pickle is a module that enables serialization and de-serialization of the structure of the object in python. Pickling is the process that uses the protocols to convert the Python...

5 minutes read.

Defaultdict in Python

In this tutorial, we will study What is defaultdict in Python We will understand it with the aid of certain examples. Before this, we will have a look at dictionaries...

3 minutes read.

Subprocess in Python

In this tutorial, we will understand what is a subprocess in python and will understand how to use it. Subprocess A subprocess is a very prevailing portion of the python library. It...

3 minutes read.

Python Uses

Python has advanced in recent years to rank among the programming languages that are most often used globally. It is utilized in everything, including machine learning, software testing, and website...

4 minutes read.