We have seen how to use
import statements to
import various modules and to use them in our programs. Python itself comes with several built-in modules, but the python community has more to offer.
Its the modules that makes python so powerful!
Third party modules add so much more functionality to Python. Now we would learn how to install these modules so that we can use those in our programs.
The simplest way is to use
pip install <module_name>
If you have used
npm, then you can think of it as npm of python.
Last time, in
import-statements wiki we used
requests module as an example. As it is a third party module we have to install it separately after installing python.
Installing it would be as simple as
pip install requests . You can even pass various arguments along with it. The one that you’ll come across more often is
--upgrade. You can upgrade a python module by :
pip install <module_name> --upgrade
For example, to upgrade the requests module to its latest version would be as simple as
pip install requests --upgrade.
pip, you will need to install it (it’s quite simple). You can install it from here
Just click on the link. And save the file as
get-pip.py Please don’t forget the
.py extension. And run it.
An alternative to using pip would be to try
easy_install is also simple. The syntax is:
pip is more popular than using