2017-04-06 102 views
1

我有问题编译python 3.6 exe使用cx_Freeze-5.0.1-cp36-cp36m-win32.whl,请帮助我。cx_Freeze:主脚本中的Python错误。 Python 3.6 + cx_Freeze

我已经安装了CX-冻结从http://www.lfd.uci.edu/~gohlke/pythonlibs/#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

看来,该方案没有找到依赖关系,以便添加这个(你必须添加缺少的依赖关系(在这个例子中,我把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")]) 
+0

谢谢你的回答!你能告诉我,我应该把这个字符串放在哪个文件中? - > build_exe_options = {“packages”:[“os”],“excludes”:[“tkinter”]} < - – Aleks

+0

当然,在安装程序调用之前的setup.py文件中。有时Cx-freeze无法识别库你必须指定。 :)请投票回答:) –

+0

非常感谢!我会尝试!当然,我会投票答复,但我不能立即做出来,因为我刚刚注册并且声望小于15 – Aleks