gpt4 book ai didi

python - cx_Freeze 无法用 pandas 构建 msi

转载 作者:行者123 更新时间:2023-11-28 18:59:06 24 4
gpt4 key购买 nike

您好,我有一个应用程序的以下 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: no file named sys (for module collections.sys)

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

ImportError: Missing required dependencies['numpy']

enter image description here

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

最佳答案

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

尝试将以下内容添加到您的设置脚本中

packages = ['numpy']

并根据

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

关于python - cx_Freeze 无法用 pandas 构建 msi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54826660/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com