【问题标题】:error with cx_freeze No module named 'ttkwidgets'cx_freeze 出错没有名为“ttkwidgets”的模块
【发布时间】:2020-07-14 14:20:21
【问题描述】:

我想冻结我的程序,但是当我这样做并启动 .exe 时,我收到以下消息

No module named 'ttkwidgets'

这里是安装文件

import sys
from cx_Freeze import setup, Executable

base = None
if sys.platform == 'win32':
    base = 'Win32GUI'

options = {
    'build_exe': {
        'includes': 'atexit'
    }
}

executables = [
    Executable('BouclePrincipale.py', base="Win32GUI")
]

setup(name='simple_Tkinter',
      version='0.1',
      description='Sample cx_Freeze Tkinter script',
      executables=executables
      )

【问题讨论】:

  • 你试过用pip安装ttkwidgets吗?
  • 我使用 pip 安装,因为程序在冻结之前可以正常运行
  • 你自己安装了 tkinter 模块吗?
  • 我认为是的,tkinter 默认不包含在 python 中?
  • 据我所知。试试“pip install tkinter”看看能不能解决。

标签: python cx-freeze ttkwidgets


【解决方案1】:

好吧,我下载了 ttkwidgets 的文件夹,然后手动放入了文件夹 Lib。 之后我有很多其他错误(抱歉我没有写错误)但我必须在脚本中添加

from tkinter import font 
from tkinter import filedialog

在那之后我遇到了 PIL 和图像问题,我就这样做了

python -m pip install --upgrade pip 
python -m pip install --upgrade Pillow

当我冻结我的程序时,它一切正常

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-04
    • 1970-01-01
    • 2017-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多