0

This is my cx_freeze setup.py file, with all the modules that I need:

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

When I build exe and run the main .exe file I get this error:

cx_freeze error If you need any other code, just ask me! (See also previous posts for some snippets) Thanks

4

1 回答 1

0

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

代码:

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")])
于 2017-10-18T14:13:08.840 回答