PyQt4 GUI到exe使用py2exe - 添加python27.dll导致崩溃

时间:2015-06-22 13:13:59

标签: python python-2.7 matplotlib pyqt4 py2exe

我使用PyQt4(PyQt4.QtGui和PyQt4.QtCore)创建了一个GUI,这个GUI包括使用matplotlib绘图,导入我自己编写的几个模块,GUI也有一个图标。 我使用的是Python2.7。

我的模块与GUI.py位于同一目录中,icon.jpg也是如此。

我的setup.py代码:

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
)

问题是当我在cmd上运行python setup.py它到达Adding python27.dll as resource然后我收到错误,说python.exe已停止工作。为什么会这样,我该如何解决?

此外,如果还有其他我应该包含的内容,或者反过来排除,请告诉我它们是什么。

0 个答案:

没有答案
相关问题