python - cx_freeze - 关于外部模块的错误 transifex.api

python - cx_freeze - Error about external module transifex.api

这是我的 cx_freeze setup.py 文件,包含我需要的所有模块:

import sys
from cx_Freeze import setup, Executable
import os

os.environ['TCL_LIBRARY'] = "C:\Users\Maicol\AppData\Local\Programs\Python\Python36\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\Users\Maicol\AppData\Local\Programs\Python\Python36\tcl\tk8.6"

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os",
                                  "numpy",
                                  "tkinter",
                                  "zipfile",
                                  "subprocess",
                                  "time",
                                  "gettext",
                                  "ctypes",
                                  "locale",
                                  "PIL.Image",
                                  "PIL.ImageTk",
                                  "webbrowser",
                                  "feedparser",
                                  "transifex.api",
                                  "polib"],
                     "includes":["transifex.api.requests.packages.core.idnadata"],
                     'include_files':['LICENSE',
                                      "changelog.txt",
                                      "tcl86t.dll",
                                      "sld_icon_beta.ico",
                                      "tk86t.dll",
                                      "images",
                                      "icons",
                                      "locale"],
                     "include_msvcr": True
                     }

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "School Life Diary",
        version = "0.3",
        author="maicol07",
        description = "Diario scolastico sempre con te!",
        options = {"build_exe": build_exe_options},
        executables = [Executable("main.py",
                                  base=base,
                                  icon="sld_icon_beta.ico",
                                  shortcutName="School Life Diary",
                                  shortcutDir="DesktopFolder"),
                       Executable("settings.py"),
                       Executable("subjects.py"),
                       Executable("timetable.py")])

当我构建 exe 和 运行 主 .exe 文件时,出现此错误:

如果您需要任何其他代码,请问我! (另请参阅以前的帖子以获取一些片段) 谢谢

我自己解决了删除 includes 列表并在 packages 列表中添加 "idna"

代码:

import sys
from cx_Freeze import setup, Executable
import os

os.environ['TCL_LIBRARY'] = "C:\Users\Maicol\AppData\Local\Programs\Python\Python36\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\Users\Maicol\AppData\Local\Programs\Python\Python36\tcl\tk8.6"

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os",
                                  "numpy",
                                  "tkinter",
                                  "zipfile",
                                  "subprocess",
                                  "time",
                                  "gettext",
                                  "ctypes",
                                  "locale",
                                  "PIL.Image",
                                  "PIL.ImageTk",
                                  "webbrowser",
                                  "feedparser",
                                  "requests",
                                  "idna",
                                  "transifex.api",
                                  "polib",
                                  ],
                     #"includes":["transifex.api.requests.packages.core.idnadata"],
                     'include_files':['LICENSE',
                                      "changelog.txt",
                                      "tcl86t.dll",
                                      "sld_icon_beta.ico",
                                      "tk86t.dll",
                                      "images",
                                      "icons",
                                      "locale"],
                     "include_msvcr": True
                     }

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "School Life Diary",
        version = "0.3",
        author="maicol07",
        description = "Diario scolastico sempre con te!",
        options = {"build_exe": build_exe_options},
        executables = [Executable("main.py",
                                  base=base,
                                  icon="sld_icon_beta.ico",
                                  shortcutName="School Life Diary",
                                  shortcutDir="DesktopFolder"),
                       Executable("note.py"),
                       Executable("settings.py"),
                       Executable("subjects.py"),
                       Executable("timetable.py")])