From: Bruce W. <bru...@gm...> - 2006-08-29 06:10:08
|
Hi, Travis I can pack my scripts into an executable with py2exe, but errors occur once it runs: No scipy-style subpackage 'random' found in D:\test\dist\numpy. Ignoring: No module named info import core -> failed: No module named _internal import lib -> failed: 'module' object has no attribute '_ARRAY_API' import linalg -> failed: 'module' object has no attribute '_ARRAY_API' import dft -> failed: 'module' object has no attribute '_ARRAY_API' Traceback (most recent call last): File "main.py", line 9, in ? File "numpy\__init__.pyc", line 49, in ? =01=07=02 File "numpy\add_newdocs.pyc", line 2, in ? =10gkDc File "numpy\lib\__init__.pyc", line 5, in ? File "numpy\lib\type_check.pyc", line 8, in ? File "numpy\core\__init__.pyc", line 6, in ? File "numpy\core\umath.pyc", line 12, in ? File "numpy\core\umath.pyc", line 10, in __load AttributeError: 'module' object has no attribute '_ARRAY_API' This is the main.py file: #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # filename:main.py import wx import numpy class myFrame(wx.Frame): def __init__(self, *args, **kwds): wx.Frame.__init__(self, *args, **kwds) ##------ your widgets ##------ put stuff into sizer self.sizer_ =3D wx.BoxSizer(wx.VERTICAL) ## self.sizer_.Add(your_ctrl, proportion =3D 1, flag =3D wx.EXPAND) ## apply sizer self.SetSizer(self.sizer_) self.SetAutoLayout(True) def main(): ## {{{ app =3D wx.PySimpleApp(0) frame =3D myFrame(None, -1, title =3D '') frame.Show(True) app.SetTopWindow(frame) app.MainLoop() ## }}} if __name__ =3D=3D "__main__":main() #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # filename:setup.py import glob import sys from distutils.core import setup import py2exe includes =3D ["encodings", "encodings.*", ] excludes =3D ["javax.comm"] options =3D { "py2exe": { #"compressed": 1, #"optimize": 0, #"bundle_files":2, "skip_archive":1, "includes": includes, 'excludes': excludes } } setup( version =3D "0.1", description =3D "", name =3D "test", options =3D options, windows =3D [ { "script":"main.py", } ], #zipfile =3D None, ) and I run this command to compile the scripts: python setup.py py2exe and all packages I use are: python2.4.3 numpy-0.98 py2exe-0.6.5 wxpython-2.6.3.2 I unistalled Numeric before I compiled scripts. If you google "numpy py2exe", you can find others guys stumbled by the same issue with ease: http://aspn.activestate.com/ASPN/Mail/Message/py2exe-users/3249182 http://www.nabble.com/matplotlib,-numpy-and-py2exe-t1901429.html I just hope this can be fixed in the next table release of numpy. On 8/29/06, Travis Oliphant <oli...@ie...> wrote: > bruce.who.hk wrote: > > Hi, Travis > > > > I just wonder if NumPy 1.0b4 can get along with py2exe? Just a few week= s ago I made a application in Python. At first I used Numpy, it works OK, b= ut I cannot pack it into a workable executable with py2exe and the XXX.log = saied that numpy cannot find some module. I found some hints in py2exe wiki= , but it still doesn't work. At Last I tried Numeric instead and it got OK.= I just hope that you donnot stop the maintenance of Numeric before you are= sure that Numpy can work with py2exe. > > > We've already stopped maintenance of Numeric nearly 1 year ago. If > NumPy doesn't work with py2exe then we need help figuring out why. The > beta-release period is the perfect time to fix that. I've never used > py2exe myself, but I seem to recall that some have been able to make it > work. > > The problem may just be listing the right set of modules to carry along > because you may not be able to get that with just the Python-side > imports. Post any errors you receive to > num...@li... > > Thanks, > > > -Travis > > Bruce Who |