We have used only pythons built in modules up to this point in the course. However, there are hundreds or thousands of other modules, custom modules available to us in Python, most of them being focused on a specific task or area. For instance, you may encounter modules that are built for handling Excel files, or databases or web scrapping network devices, scientific operations and so on. This means that whenever you want to build a specific application, you may have several non default Python modules available for download and use completely free. Most of them have their own GitHub Pages or websites and extensive documentation may be available for most of them. That's why it is very important for you to know how to properly download and install a Python module and have it ready to use inside your scripts.
In the Python interpreter, don't worry, the process of installing a non built in module is very straightforward. Python provides By default, the PIP package manager. Pip is a package management system used to install and manage software packages written in Python. Pip will handle the entire download and installation process, including the download of any dependencies if necessary. Let's say we want to build an application that will handle Excel spreadsheets. And we find out that there is a module named open pi Excel that can help us this is a non default Python module.
And to prove this, let's get into the Python interpreter and try to import this module. So import open pi Excel. Of course, we got module not found exception because this module is not a built in module. Now to automatically download and install this module, along with Any necessary dependencies. Let's open up the windows command line and use the package manager. The command you should use is by Thawne dash m, pip install, and now the name of the module open pi Excel.
So we have the Python command dash M, which stands for module, the name of the package manager Pip, the action to be performed install, and finally the name of the module we want to install. Now after hitting Enter, the module is downloaded and installed. Of course, make sure your internet connection is up and running before using Pip. So let's hit enter. Great, it seems that the installation was successful. Now let's verify this in the Python interpreter by trying to import the module once again.
So this time import PY Excel. And indeed this time, we get no exceptions. And we can already use the new module. Also overtime. Returning to the windows command line, you may see that the PIP version on your system gets outdated as new versions are released. In order to upgrade the PIP software manager, you should use the command Python dash m, pip install, dash dash, upgrade.
And finally, Pip. If I press enter Now, you can see that in my case requirement already up to date. So I have the latest version of PIP already installed on my Windows operating system. Great. So in this lecture, you learned how to properly install a non default Python module using the PIP package manager and also how to upgrade PIP itself. See you in the next lecture.