【问题标题】:cx_Freeze not able to build msi with pandascx_Freeze 无法使用 pandas 构建 msi
【发布时间】:2019-02-22 12:00:59
【问题描述】:

您好,我有以下 cx_Freeze setup.py 文件,用于使用 pandas 模块。当我生成msi 时,我遇到了问题。我在谷歌上到处找这个,但没有一个对我有用。

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])

当我用cx_Freeze==4.3.4 构建msi 时,它给出了 这个错误:

cx_Freeze.freezer.ConfigError: 没有名为 sys 的文件(用于模块 collections.sys)

当我使用cx_Freeze >= 5.0.0 时,会创建msi,但安装后会给出

ImportError: 缺少必需的依赖项['numpy']

我尝试了所有可用的堆栈溢出解决方法,但没有一个有效,任何建议都会有很大帮助,在此先感谢。

【问题讨论】:

    标签: python pandas cx-freeze


    【解决方案1】:

    pandas 依赖于numpy,您需要将numpy 显式添加到build_exe 选项的packages 列表中,以便cx_Freeze 正确包含numpy,请参见Creating cx_Freeze exe with Numpy for Python

    尝试将以下内容添加到您的安装脚本中

    packages = ['numpy']
    

    并根据

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

    【讨论】:

    • 嗨@jpeg,我试过你说的,运行应用程序后仍然得到相同的 ImportError: missing required dependencies['numpy']。
    • 嗨@jpeg 感谢解决方案 packages=['numpy'] 工作,问题是我在更改不同版本的 cx_Freeze 后没有重新启动系统。
    猜你喜欢
    • 2014-05-30
    • 1970-01-01
    • 2018-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-17
    • 2021-10-18
    相关资源
    最近更新 更多