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开发者_JAVA百科 in the matplotlib directory and we're using:
from matplotlib.pylab import *
Any ideas?
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.
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.
Try importing like this:
from pylab import *
精彩评论