簡體   English   中英

exe錯誤與cx_freeze

[英]exe error with cx_freeze

嘿,編譯python腳本到exe是相對較新的。 我使用cx_freeze編譯我的腳本,一旦它構建我運行exe,它給了我這個錯誤。 谷歌周圍很多但不太確定。 錯誤是:

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

不太確定如何解決這個問題。 我讀到可能在名為re的模塊之間存在沖突? 在python? 和一個名為re的模塊在cx_freeze模塊中?

我的設置文件如下:

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]
        )

試着改變

includes = []

includes = ["re"]

這對我有用

如果運行時工作目錄不是可執行文件所在的目錄,則cx_freeze將為barf。

你是第一次進口嗎? 當你以不同的順序執行時會發生什么?

遇到同樣的問題將re includes並不適用於我。 它在重建.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")])

如果我把re放在packages而不是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")])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM