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!
- Installing pip in python (Windows)
- First of all, to check the version of python installed on our PCs, we will type the python –version in the command prompt.
- 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.
- Download the get-pip.py installer script and save it with the extension .py
- 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
- We will install pip using get-pip.py.
- 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
- install - It installs the packages.
- download - It downloads the packages.
- uninstall - It uninstalls the packages.
- freeze - It output the installed packages in requirements format.
- list - It lists the installed packages.
- show - It shows information about the installed packages.
- check - It verifies the installed packages that have compatible dependencies.
- config - It manages the local and global configuration.
- search - It searches the PyPI for packages.
- wheel - It builds wheels from our requirements.
- hash - It computes hashes of package archives.
- completion - A helper command is used for command completion.
- help - It shows help for commands.
What are the General Options:
- -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.