py2exe python executable for matplotlib

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PamMish1982
    New Member
    • Aug 2008
    • 1

    py2exe python executable for matplotlib

    Hi all,

    I have recently started using Python and I am trying to make a GUI out of Tkinter. I am using matplotlib for the graphic purposes. I have to make a exe file from this code. I use py2exe for this purpose but every time I try to make this exe using a setup file I get these errors. Final.py is my python code.

    Traceback (most recent call last):
    File "Final.py", line 5, in <module>
    File "pylab.pyc" , line 1, in <module>
    File "matplotlib\pyl ab.pyc", line 204, in <module>
    File "matplotlib\mpl .pyc", line 10, in <module>
    File "matplotlib\fig ure.pyc", line 33, in <module>
    File "matplotlib\pro jections\__init __.pyc", line 1, in <module>
    File "matplotlib\pro jections\geo.py c", line 4, in <module>
    File "matplotlib\num erix\__init__.p yc", line 166, in <module>
    ImportError: No module named ma

    I checked out 'ma' which is actually a import line in geo.py which says:
    from matplotlib.nume rix import npyma as ma

    I guess there is a problem with importing these files. This is my setup file:


    from distutils.core import setup
    import sys
    import os
    import glob
    import py2exe
    import matplotlib
    import numpy


    opts = {
    'py2exe': { "includes" : [ "matplotlib.bac kends", "matplotlib.bac kends.backend_q t4agg",
    "matplotlib.fig ure","pylab", "numpy", "matplotlib.num erix.fft",
    "matplotlib.num erix.linear_alg ebra", "matplotlib.num erix.random_arr ay",
    "matplotlib.bac kends.backend_t kagg", "matplotlib.pro jections" , ],
    'excludes': ['_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg',
    '_fltkagg', '_gtk', '_gtkcairo', ],
    'dll_excludes': ['libgdk-win32-2.0-0.dll',
    'libgobject-2.0-0.dll']
    }

    }
    data_files = [(r'mpl-data', glob.glob(r'C:\ Python25\Lib\si te-packages\matplo tlib\mpl-data\*.*')),
    (r'mpl-data', [r'C:\Python25\L ib\site-packages\matplo tlib\mpl-data\matplotlib rc']),
    (r'mpl-data\images',gl ob.glob(r'C:\Py thon25\Lib\site-packages\matplo tlib\mpl-data\images\*.* ')),
    (r'mpl-data\fonts',glo b.glob(r'C:\Pyt hon25\Lib\site-packages\matplo tlib\mpl-data\fonts\*.*' ))]
    setup(windows=[{"script" : "Final.py"}], options=opts, data_files=data _files)



    Can someone please help me with this.

    Thanks,
Working...