Python follows a “batteries included” philosophy, which means that a lot of functionality you may need is built in to the language itself.Python developers have developed their own modules to extend Python’s capabilities even further. These third party modules are kept in the Python Package Index or PyPI which is similar to an app store of free Python programs. At the time of this writing, there are more than 100 000 modules on PyPI.
In order to download and install a Python module from PyPI, we use a program called pip. PIP stands for “Pip Installs Packages. pip can connect to PyPI, download any module we are interested in and add it to Python.
Installing pip
Pip comes installed with Python 3.4 for Windows and OS X. To install pip on Linux do this:
$ sudo apt-get install python3-pip
You will need to enter your super user password to allow the installation to continue.
Once pip has been installed, it can now be used find a module in PyPI. To run pip
, type this into the terminal:
$ pip install <name-of-module>
where is the name of module you intend to download. pip will download the module from PyPI and take care of the installation. To test that the downloaded module installed successfully, start Python in interactive mode and import the new module, if you don’t get any errors, that means the module has been successfully installed.