I'm trying to 'freeze' a script of mine using py2exe and I
> cant seem to get it to play nicely with matplotlib. More
> specifically, my script is a wxpython frame that displays
> several data plots that are created with the Agg backend
> and converted to bitmaps. From my limited knowledge of
> py2exe it appears that the problem arises from py2exe
> trying to import several backends at once.
Hi Colin,
Sorry for the delay in getting back to you. I just started playing
with py2exe. I have an app that uses matplotlib that I would like to
freeze as well, so may as well take the plunge.
I found I could freeze a simple plot with
# setup.py
from distutils.core import setup
import glob
import py2exe
data = glob.glob(r'C:\Python23\share\matplotlib\*')
data.append(r'C:\Python23\share\matplotlib\.matplotlibrc')
setup(console=["simple_plot.py"],
data_files=[("share",data)],
)
where simple_plot.py is
from matplotlib.matlab import *
plot([1,2,3])
show()
I also got a similar warning message at the end like you about "The
following modules appear to be missing" but it appears to be harmless.
A simple_plot.exe was created in my dist dir, as were a number of dlls
and the matplotlib share data dir. I had to set the MATPLOTLIB env
var to point to the share dir, ie
set MATPLOTLIBDATA=c:\python\jdh\py2exe\simple_plot\dist\share
but then it (partly) worked. TkAgg and WXAgg worked out of the box (I
could change the default backend in the rc file). Plain vanilla WX
behaved strangely: The WX frame with navigation bars etc popped up but
no graph. I could click 'save' and save the graph to a jpeg which
viewed correctly. But no image in the wx frame. Hmm. Haven't gotten
GTK* working yet.
Are you using the latest py2exe? Notably, I didn't get the gtk dll
error when I left out the excludes.
JDH