Mike
Mike

Reputation: 1844

Matplotlib + Pylab import error

Been struggling to resolve this for most of the day, hoping someone can assist...

I'm running python 2.7, have installed matplotlib but when attempting to get started and import pylab I receive errors saying that no module is found, even when there is clearly a pylab module in the matplotlib directory and we're using:

from matplotlib.pylab import *

Any ideas?

Upvotes: 2

Views: 6875

Answers (3)

Mike
Mike

Reputation: 1844

Solved!

I had the script I was testing with in the same directory as the original 'matplotlib' directory from install. Using print sys.path I saw this was where the script was looking for the pylab files rather than the matplotlib directory in site-packages.

Thanks.

Upvotes: 3

amillerrhodes
amillerrhodes

Reputation: 2702

Try importing like this:

from pylab import *

Upvotes: 0

Nicolas Paris
Nicolas Paris

Reputation: 134

An easy mistake could be to name the file the same way as the module. I already made the mistake for example, when trying curses, and naming the file curses.py. I had to remove the .py and .pyc files to make it works.

Upvotes: 2

Related Questions