Easy Tutorial
❮ Matplotlib Tutorial Matplotlib Line ❯

Matplotlib Installation

In this section, we will use the pip tool to install the Matplotlib library. If you have not installed this tool yet, you can refer to Python pip Installation and Usage.

Upgrade pip:

python3 -m pip install -U pip

Install the matplotlib library:

python3 -m pip install -U matplotlib

After installation, we can import the matplotlib library using import:

import matplotlib

The following example demonstrates importing the matplotlib library and then checking its version number:

Example

import matplotlib

print(matplotlib.__version__)

Executing the above code will produce the following output:

3.4.2
❮ Matplotlib Tutorial Matplotlib Line ❯