cx_Freeze:主脚本中的Python错误。 Python 3.6 + cx_Freeze

时间:2017-04-06 08:54:45

标签: python cx-freeze python-3.6 traceback

我在使用cx_Freeze-5.0.1-cp36-cp36m-win32.whl编译python 3.6到exe时遇到问题,请帮帮我。

我已经从http://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze

安装了Cx-freeze

然后我启动cmd并运行此命令:

    python setup.py build

setup.py文件如下:

        import sys
    from cx_Freeze import setup, Executable

    setup(
        name = "Check Telemetry",
        version = "0.1",
        description = "Check Telemetry",
        executables = [Executable("excel_to_sqlite_xlrd-light.py", base = "console")])

然后我有这样的事情: enter image description here

但如果我运行我的.exe文件,我有以下问题: enter image description here

屏幕截图显示以下错误: enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

你有什么想法吗? 谢谢!

1 个答案:

答案 0 :(得分:1)

似乎程序没有找到依赖项,所以添加它(你必须添加缺少的依赖项(在这个例子中我把os):

    # Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}

然后:

setup(  name = "Check Telemetry",
        version = "0.1",
        description = "Check Telemetry",
        options = {"build_exe": build_exe_options},
        executables = [Executable("excel_to_sqlite_xlrd-light.py", base = "console")])