wxpython打包应用_将python应用程序(使用enhough、matplotlib、wxpython)打包到executab中...

这是对我有效的解决方案。在

我尝试过使用bbfreeze、PyInstaller、py2exe和cx_Freeze。最后,我决定使用cxu Freeze,因为它显然很受那些用热心类打包应用程序的人的欢迎。在

使用cx_Freeze时,我得到了与上面类似的错误消息。问题是它将必要的模块保存在“图书馆.zip“文件,这是一些热心的类,包括mayavi有问题。幸运的是,cx\u Freeze允许指定"create_shared_zip": False选项,这样就可以将源文件直接复制到构建目录中,而不是压缩文件中。在

此外,我还发现一些令人兴奋的文件和文件夹必须手动包含在include_files(scipy,source:here)中。在这之后它起作用了。我在下面添加了我的安装文件代码,希望能有所帮助。在import sys

import os

from cx_Freeze import setup, Executable

import scipy

scipy_path = os.path.dirname(scipy.__file__) #use this if you are also using scipy in your application

build_exe_options = {"packages": ["pyface.ui.wx", "tvtk.vtk_module", "tvtk.pyface.ui.wx", "matplotlib.backends.backend_tkagg"],

"excludes": ['numarray', 'IPython'],

"include_files": [("C:\\Python27\\Lib\\site-packages\\tvtk\\pyface\\images\\", "tvtk\\pyface\\images"),

("C:\\Python27\\Lib\\site-packages\\pyface\\images\\", "pyface\\images"),

("C:\\Python27\\Lib\\site-packages\\tvtk\\plugins\\scene\\preferences.ini", "tvtk\\plugins\\scene\\preferences.ini"),

("C:\\Python27\\Lib\\site-packages\\tvtk\\tvtk_classes.zip", "tvtk\\tvtk_classes.zip"),

("C:\\Python27\\Lib\\site-packages\\mayavi\\core\\lut\\pylab_luts.pkl","mayavi\\core\\lut\\pylab_luts.pkl"),

("C:\\Python27\\Lib\\site-packages\\mayavi\\preferences\\preferences.ini","mayavi\\preferences\\preferences.ini"),

("C:\\Python27\\Lib\\site-packages\\numpy\\core\\libifcoremd.dll","numpy\\core\\libifcoremd.dll"),

("C:\\Python27\\Lib\\site-packages\\numpy\\core\\libmmd.dll","numpy\\core\\libmmd.dll"),

(str(scipy_path), "scipy") #for scipy

]

,"create_shared_zip": False #to avoid creating library.zip

}

executables = [

Executable('myfile.py', targetName="myfile.exe", base=None)

]

setup(name='myfile',

version='1.0',

description='myfile',

options = {"build_exe": build_exe_options},

executables=executables

)

配置:

^{pr2}$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值