Alq*_*sta 5 python exe tkinter cx-freeze python-3.x
我正在尝试使用ttk模块为tkinter中的GUI应用程序创建Windows的可执行文件.我用cx_freeze创建了一个exe,但是当我在控制台中运行应用程序时,它给出了以下错误:
D:\My Dropbox\python\SAR Calculator\src\dist_tk>
Traceback (most recent call last):
File "C:\Python31\lib\site-packages\cx_Freeze\
7, in <module>
exec(code, m.__dict__)
File "sarcalc_tk.py", line 14, in <module>
File "C:\Python31\lib\tkinter\__init__.py", li
from tkinter import _fix
ImportError: cannot import name _fix
Run Code Online (Sandbox Code Playgroud)
以下是我的代码中的第14行和第15行:
import tkinter as tk
import tkinter.ttk as ttk
Run Code Online (Sandbox Code Playgroud)
看起来cx_freeze没有意识到它应该包含tkinter._fix有条件导入的模块tkinter/__init__.py.您可以告诉它使用--include-modules命令行参数显式包含该模块,或者在您的模块中包含includes关键字参数cx_Freeze.Executablesetup.py