I have created a GUI using PyQt4 (PyQt4.QtGui and PyQt4.QtCore), this GUI includes graphing using matplotlib, importing a couple of modules I wrote myself, the GUI also has an icon. I am using Python2.7.
My modules are in the same directory as GUI.py
, as is the icon.jpg
.
My setup.py code:
from distutils.core import setup
import py2exe, sys, os
import matplotlib as mpl
mpl.use('Qt4Agg') #I use this is GUI.py
sys.argv.append('py2exe')
includes = ['sip', 'PyQt4', 'PyQt4.QtGui', 'PyQt4.QtCore', 'matplotlib.backends']
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'pydoc', 'doctest', 'test', 'wx']
packages = ['matplotlib'] #should my custom modules go in here?
dll_excludes = ["MSVCP90.dll", "MSWSOCK.dll", "mswsock.dll", "powrprof.dll",
'libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
"libgdk_pixbuf-2.0-0.dll"]
data_files = mpl.get_py2exe_datafiles()
setup(name = "main",
windows = [{"script":"GUI.py", "icon_resources": [(1, "icon.jpg")]}],
options = {'py2exe': {
'compressed': True,
'includes': includes,
'excludes': excludes,
'packages': packages,
'dll_excludes': dll_excludes,
'bundle_files': 1}},
zipfile = None,
data_files = data_files
)
The problem is when I run python setup.py
on the cmd it gets to Adding python27.dll as resource
and then i get an error saying python.exe has stopped working. Why is this, and how do I fix it?
Also, if there are other things that I should include, or conversely exclude please inform me what they are.