简体   繁体   中英

matplotlib does not work in Eclipse

I seem to have a problem that is in parts very similar to the one mentioned here:
Python with eclipse import problem

But unfortunatly just in parts otherwise that would have solved mine as well.

I use Eclipse SDK, Version: 3.7.0 with PyDev 101. Furthermore I have installed numpy-1.6.1rc1-win32-superpack-python2.6.exe and matplotlib-1.0.1.win32-py2.6.exe as noted here: http://matplotlib.sourceforge.net/users/installing.html

I have rebuild all the packages and looks the site-packages are listed.

(by the way as you see it is an Python version installed with ArcGIS )

If I test a script for instance a very simple one like:

import numpy 
import matplotlib
import pylab as pl

I get the following error in Eclipse: import matplotlib import pylab as pl from matplotlib.pylab import * ImportError: No module named pylab

Even though the interpreter for Pydev is pointing to the appropriate version of python and matplotlib is installed properly in there (site-packages) it does not work in Eclipse. In iPython it works perfect.

What still needs to be done to get matplotlib work in Eclipse?

Thanks a lot!

Werner

pylab is in matplotlibs namespace, so this should work:

import matplotlib.pylab as pylab

I found that turning off interactive move and then calling show worked.

import matplotlib.pyplot as plt

#...your code...

plt.ioff()
plt.show()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM