felipeformenti
felipeformenti

Reputation: 177

pylab cannot find reference for its modules

I have a mac OS X Yosimite and I'm using python 2.7.10 and Pycharm as my IDLE. I have pylab installed properly but I cannot use any of its modules.

When a try:

from pylab import show 

(or any module) it says

ImportError: cannot import name show

But when I run just the line import pylab I get no errors!

I tried leaving that way and calling the module anyway.

pylab.imshow(...)

But I got the same error obviously. Do I have to install those modules separately? PS: I'm almost sure the problem has nothing to do with the interpreter

Upvotes: 1

Views: 1257

Answers (1)

tmdavison
tmdavison

Reputation: 69116

Try importing from matplotlib.pyplot, rather than from pylab (this is now the recommended way to import matplotlib):

From example:

from matplotlib.pyplot import imshow
imshow()

Or:

import matplotlib.pyplot as plt
plt.imshow()

Upvotes: 2

Related Questions