Install matplotlib and matplotlib
1. Install matplotlib in Linux
If you are using the Python version that comes with the system, you can use the Package Manager of the system to install matplotlib. Therefore, you only need to execute one line of command:
$ Sudo apt-get install python3-matplotlib
If we use Python2.7, run the following command:
$ Sudo apt-get install python-matplotlib
If we have installed a newer Python version, we must install some libraries that matplotlib depends on:
$ Sudo apt-get install python3.5-dev python3.5-tk-dev
$ Sudo apt-get install libfreetype6-dev g ++
Then use pip to install matplotlib:
$ Pip install -- user matplotlib
Ii. Test matplotlib
Install the necessary packages and test the installation. To solve this problem, run python or Python3 to start a terminal session and try to import matplotlib:
$ Python3
>>> Import matplotlib
>>>
If no error message is displayed, it indicates that matplotlib is installed in our system.