问题描述
- 关于Py2exe 打包pyqt4包含matplotlib的问题(python2.7)
-
我想用py2exe打包一个pyqt4的项目,其中包括了matplotlib画图,生成exe的文件过程没有问题,但是双击exe后无法运行(也没有报错),代码如下:from distutils.core import setup
import py2exe
import sys
import glob#this allows to run it with a simple double click.
sys.argv.append('py2exe')py2exe_options = {
"includes": ["sip","matplotlib.backends","matplotlib.figure","pylab","numpy",
"matplotlib.backends.backend_tkagg"],
'excludes':['_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg','_fltkagg','_gtk', '_gtkcairo', ],
"dll_excludes": ["MSVCP90.dll",'libgdk-win32-2.0-0.dll',
'libgobject-2.0-0.dll'],
"compressed": 1,
"optimize": 2,
"ascii": 0,
"bundle_files": 1,
}
data_files= [(r'mpl-data',glob.glob(r'C:Python27Libsite-packagesmatplotlibmpl-data*.*')),(r'mpl-data',[r'C:Python27Libsite-packagesmatplotlibmpl-datamatplotlibrc']),
(r'mpl-dataimages',glob.glob(r'C:Python27Libsite-packagesmatplotlibmpl-dataimages*.*')),
(r'mpl-datafonts',glob.glob(r'C:Python27Libsite-packagesmatplotlibmpl-datafonts*.*'))]
setup(
name = 'test2',
version = '1.0',
windows = ['test2.py'],
zipfile = None,
options = {'py2exe': py2exe_options},
data_files=data_files
)
解决方案
py2exe 打包 PyQt4 的问题
python2.6 py2exe打包问题
py2exe打包问题
解决方案二:
是不是有什么依赖的文件没有代入。