Install MatPlotLib on windows

I cannot get MatPlotLib to work. I downloaded and installed the correct version (matplotlib-1.1.0.win32-py2.7.exe) and I already have numpy and scipy installed (and they work without problems).

This is the error I get:

C:\python code>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 95, in <module>
    new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\Python27\lib\site-packages\matplotlib\backends\__init__.py", line 25,
 in pylab_setup
    globals(),locals(),[backend_name])
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", lin
e 8, in <module>
    import Tkinter as Tk, FileDialog
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 38, in <module>
    import FixTk
  File "C:\Python27\lib\lib-tk\FixTk.py", line 65, in <module>
    import _tkinter
ImportError: DLL load failed: %1 is not a valid Win32 application.
>>>

Any ideas?

+5
source share
3 answers

This problem occurs if you have a previous 64-bit version of python that was incorrectly removed.

Correctly uninstall both versions of python and then reinstall 32-bit python, fixing the problem.

+7
source

Zach the best way to install matplotlib on windows is to switch to Python (x, y) as a bundle. All dependencies are resolved, and you get a really cool IDE and complete documentation.

Python (x, y) ,

+3

32- .

0
source

All Articles