liv2hak liv2hak - 4 years ago 111
Python Question

matplotlib can't be used from python3

I have two python compilers on my Ubuntu 14.04 VM. I have installed


pip install matplotlib

But the matplotlib cannot be used from python3.It can be used from python2.7

If I use
import matplotlib.pyplot as plt
inside my script
and run it as


I get the error

ImportError: No module named 'matplotlib'

How can this be fixed.

Answer Source

Use pip3 to install it:

sudo apt-get install python3-pip
sudo pip3 install matplotlib
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download