ImportError: No module named matplotlib.pyplot ubuntu 21,04
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('seaborn-white')
ax1 = plt.axes()
ax2 = plt.axes([0.65, 0.65, 0.2, 0.2])
plt.show()
I have installed matplotlib using 'sudo apt-get install python3-matplotlib'and I have also tried installing it using 'pip'and 'pip3' but yet, I get the response that matplotlib has already been installed with the latest version and if i run my code i get 'ImportError: No module named matplotlib.pyplot'.
I did it by removing the python 2 package that came with the ubuntu OS and also removed the python 3 package then installed only the python 3 package again. Then it worked.