2017-04-06 73 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