2011-04-09 88 views
4

嘿相對較新的編譯python腳本exe。我使用cx_freeze編譯我的腳本,一旦它的內置我運行該exe文件,它給了我這個錯誤。有谷歌周圍很多,但不太確定。錯誤是:EXE錯誤與cx_freeze

 
Cannot import traceback module. 
Exception: No module named re 
Original Exception: No module named re 

不太清楚如何去解決這個問題。我讀到可能有名爲re的模塊之間發生衝突?在python中?在cx_freeze模塊中有一個名爲re的模塊?

我的設置文件看起來像:如果運行時的工作目錄不是可執行文件所在的目錄

from cx_Freeze import setup, Executable 

includes = [] 
includefiles = ['remindersText.pkl'] 
eggsacutibull = Executable(
    script = "podlancer.py", 
    initScript = None, 
    base = 'Win32GUI', 
    targetName = "podlancer.exe", 
    compress = True, 
    copyDependentFiles = True, 
    appendScriptToExe = False, 
    appendScriptToLibrary = False, 
    icon = None 
    ) 

setup(
     name = "Podlancer", 
     version = "0.1", 
     author = 'jono', 
     description = "Podlancer UI script", 
     options = {"build_exe": {"includes":includes, "include_files": includefiles}}, 
     executables = [eggsacutibull] 
     ) 
+0

這是cx_Freeze中的一個錯誤 - 它應該在下一個版本中修復,希望在下週左右發佈。 – 2013-09-16 21:44:47

回答

6

嘗試改變

includes = [] 

includes = ["re"] 

這對我來說

+1

傳說。 =)謝謝兄弟!想知道究竟發生了什麼大聲笑。編譯時需要包含該模塊以滿足watever的原因...因此將其納入(有意義,有點內臟,我沒有想到這一點!)...任何人都知道什麼是重新模塊? – Mafster 2011-05-28 11:38:36

+0

正則表達式 – Azimkhan 2011-09-13 16:29:35

2

cx_freeze將BARF

重新首先要做的進口?當你以不同的順序進行操作時會發生什麼?

0

會議此相同的問題將在reincludes我沒有工作的工作。它在重建.py文件時產生了cx_Freeze.freezer.ConfigError

import sys 
from cx_Freeze import setup, Executable 

build_exe_options = {'include_files': ['re']} 

setup( name = "Foreground Window Montior", 
     version = "0.1", 
     description = "Query the foreground window.", 
     options = {'build_exe': build_exe_options}, 
     executables = [Executable("actWin_Query.py")]) 

如果我把repackages而非include_files它並不會產生這種編譯錯誤。

import sys 
from cx_Freeze import setup, Executable 

build_exe_options = {"packages": ["re"]} 

setup( name = "Foreground Window Montior", 
     version = "0.1", 
     description = "Query the foreground window.", 
     options = {'build_exe': build_exe_options}, 
     executables = [Executable("actWin_Query.py")])