cx_Freeze not able to build msi with pandas

我的未来我决定 提交于 2019-12-14 01:38:38

问题


Hi I have following cx_Freeze setup.py file for an application that uses pandas module. When I generate msi I am facing issues. I looked all over the google for this but none of them are working for me.

include-files = ['aardvark.dll'] 
includes = []
excludes = []

base = "Win32GUI"
exe = Executable( 
    script="test.py",
    initScript=None,
    base=base,
    targetName="test.exe",
    copyDependentFiles=True,
    compress=False,
    appendScriptToExe=False,
    appendScriptToLibrary=False,
    shortcutDir="MyProgramMenu",
    shortcutName=APP_NAME)
bdist_msi_options = {
    "upgrade_code": UPGRADE_CODE,
    "add_to_path" : False}
setup( 
    name=APP_NAME,  
    version=VERSION,
    author="sri",
    description='test Tool',
    options={"build_exe": {"excludes":excludes,
    "includes":includes,
    "include_files":includefiles},
    "bdist_msi" : bdist_msi_option},
    executables=[exe])

When I build msi with cx_Freeze==4.3.4 it gives this error:

cx_Freeze.freezer.ConfigError: no file named sys (for module collections.sys)

and when I use cx_Freeze >= 5.0.0 the msi is created but after installing this gives

ImportError: Missing required dependencies['numpy']

I tried all the available stack overflow work around but none of them is working any suggestion will be a great help thanks in advance.


回答1:


pandas depends on numpy and you need to explicitly add numpy to the packages list of the build_exe options in order that cx_Freezeincludes numpycorrectly, see Creating cx_Freeze exe with Numpy for Python

Try to add the following to your setup script

packages = ['numpy']

and to modify the options according to

options={"build_exe": {"excludes":excludes,
                       "includes":includes,
                       "include_files":includefiles,
                       "packages":packages},
         "bdist_msi" : bdist_msi_option},


来源:https://stackoverflow.com/questions/54826660/cx-freeze-not-able-to-build-msi-with-pandas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!