From: Charles M. <cm...@in...> - 2005-08-10 17:05:57
|
Here is a simple setup.py script I am successfully using with the most recent version of mpl. I run py2exe like, "python.exe setup.py py2exe -c -p numarray,pytz". ----------------------------------- import os from distutils.core import setup import py2exe import glob for ver in range(2,5): if os.path.exists('C:\\Python2%i\\share\\matplotlib\\' % ver): data = glob.glob('C:\\Python2%i\\share\\matplotlib\\*' % ver) break setup( windows = ['nlogui.py'], data_files = [('', ['nlo.gif']), ('matplotlibdata', data)], options={"py2exe":{"optimize":2}}, ) ----------------------------------- Michael Huster wrote: > I cross-posted this on py2exe-users w/o getting help yet. > > Yes, I've read the Wiki - http://starship.python.net/crew/theller/moin.cgi/MatPlotLib > and any other pages I could google. I want to package a pylab (aka scipy, aka matplotlib) app. I'm on Win XP. I've been trying for four days. I've boiled it down to this: > > ----------------------------------------------------- > Test.py: > import pylab > a = arange(10) > print a > > ----------------------------------------------------- > Setup.py: > from distutils.core import setup > import py2exe > import glob > > # from py2exe wiki: matplotlib > """ > These don't work so I commented them out: > opts = { > 'py2exe': { 'excludes': ['_gtkagg', '_tkagg'], > 'dll_excludes': ['libgdk-win32-2.0-0.dll', > 'libgobject-2.0-0.dll'], > 'includes': ['matplotlib.numerix.random_array'], > } > } > """ > > setup( > # This doesn't make it work either: > data_files = [ > (r'lib\matplotlibdata', glob.glob(r'c:\python23\share\matplotlib\*')), > (r'lib\matplotlibdata', glob.glob(r'c:\Python23\share\matplotlib\.matplotlibrc')), > ], > version = "0.7.0", > description = "test py2exe & pylab", > name = "TestPy2exe", > author = "Michael E Huster", > # targets to build > console = ["test.py"] > > ) > ----------------------------------------------------- > I run: > Prompt> python setup.py py2exe > Prompt> cd dist > Prompt> test.exe > Traceback (most recent call last): > File "test.py", line 1, in ? > File "pylab.pyc", line 1, in ? > File "matplotlib\__init__.pyc", line 509, in ? > File "matplotlib\__init__.pyc", line 245, in wrapper > File "matplotlib\__init__.pyc", line 318, in _get_data_path > RuntimeError: Could not find the matplotlib data files > > Prompt> > > Michael Huster, Ph. D. > Assistant Professor of Science > Simpson University > 2211 College View Dr. > Redding, CA 96003 > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |