Installing python libraries using pip installer
As we see in many powerful python IDLE it is very easy to install the python libraries but in the basic python shell many of us doesn’t know how to install the libraries.
So here i will be telling how to install the libraries by pip installer using a simple command prompt in windows.
So lets see what is pip?
PIP stands for Package Index which is a package management system where the libraries are installed through this mechanism.
In our own words PIP is nothing but a vendor and it have the several libraries and we user request the pip if it accepts we get the python libraries through them.
If you have trouble in downloading the python shell. Please check this link and download it and install for windows xp/7/8/10.
Now lets open the command prompt by going to start menu and search ‘cmd’ or click run and type the command ‘cmd’ in the box. In the command prompt set the directory to the python folder where you have installed the python IDLE.
If you have trouble in finding the working directory of the python. Just open the python shell.
>>> import os
>>> print(os.getcwd())
Type this code in the python shell to get where the python IDLE is located in the system.
So once you located the working directory put it into the command prompt and set the directory.
To install the pip into windows we need to download a python file by going to this link. Once you reach the link copy the entire code and paste into the notepad and save it as get-pip.py and save it in the python folder.
Once you have placed the file in the folder call the file using command prompt.
python get-pip.py
So now we have successfully installed the pip. We need to get positive feedback from the system like in the image above. Once it shows ‘successfully installed’ then you will get your pip folder created in the directory.
Now lets see how we install the python libraries . Now open the command prompt go to the working directory. Now type the code
python -m pip install <library name>
<library name> can be anything like numpy, pandas, sklearn, matplotlib, etc. you can find as many libraries by checking python libraries documentation site.
So now we have installed the desired libraries we liked. If you want to check the desired library is installed in your system just type the import section.
>>import <library name>
>>>Traceback (most recent call last):
File “<pyshell#8>”, line 1, in <module>
import numpy
ModuleNotFoundError: No module named ‘numpy’
If you get any error like this then you have retry and install the desired library.
So you have learned how to install the python libraries using a simple python shell by command prompt in windows.
Try following my window i will posting many data science projects and difficulties faced while doing my projects.