How to install a Python library

1 min

You will need a package manager.

No worries,

It is probably already installed.

The major one is called pip

This will manage all your Python libraries in a single place.

The package indexer

If you are looking for a package it is probably referenced here :

PyPI · The Python Package Index
The Python Package Index (PyPI) is a repository of software for the Python programming language.

Check the library documentation

For every library there is a documentation,

Most of the time you will find the "How to install" section in the library documentation.

If you follow the commands they ask you to do everything should be fine.

The most basic installation command

The most common command with pip is the install command, it will install any package supplied to this command

pip install <package>
The most basic install command
pip install requests
An example with requests
pip3 install <package>
In case if you are working with Python3 (Recommended)
pip3 install requests
How to install requests in Python3

Here you are,  you should be all set to use this library in your Python workflow !