0

When i run this piece of code:

import matplotlib.pyplot as plt
import numpy as np
plt.plot([1, 2, 3, 4], [1, 4, 9, 16])
plt.show()

I get the following error message:

cannot import name 'style' from 'matplotlib'

Where is the bug?

1 Answers1

0

It could be the way you installed matplotlib. In some cases pip install matplotlib does not work. You would try the Windows installer from https://pypi.python.org/pypi/matplotlib.

If this doesn't work or it is not the case, use:

  • sudo pip install --upgrade matplotlib

or

  • pip install --user --upgrade matplotlib

Make sure that the code is from matplotlib import style