ttkbootstrap 不能与 pyinstaller 一起使用 [英] ttkbootstrap not working with pyinstaller

查看:465
本文介绍了ttkbootstrap 不能与 pyinstaller 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Python 解释器它工作正常,图像加载和 main.py 运行没有问题,但是当我使用 Pyinstaller 将它变成一个文件 .exe 时,.exe 崩溃并显示以下错误消息.

With Python Interpreter it works fine, image loads and main.py runs without problems, but when I make it into one file .exe with Pyinstaller, .exe crashes with the following error message.

FileNotFoundError: 'themes.json' resource not found in 'ttkboostrap'

真诚地感谢任何帮助.

推荐答案

有同样的问题.

转到安装 ttkbootstrap 的位置,将 themes.jsonSymbola.ttf(如果需要)复制到与你的 main.pymain.spec.

Head over to where your ttkbootstrap is installed, copy themes.json and Symbola.ttf (if required) to the same folder as your main.py and main.spec.

然后用 datas=[('themes.json', 'ttkbootstrap'), ('Symbola.ttf', 'ttkbootstrap')] a = Analysis() 下.

Symbola.ttf 但我在将 themes.json 复制到文件夹后遇到另一个 FileNotFoundError,这需要我带来 Symbola.ttf 也是.

Symbola.ttf may not be required for you but I encountered another FileNotFoundError after copying themes.json over to the folder, which required me to bring over Symbola.ttf as well.

完成后,在提升的命令提示符下运行 pyinstaller main.spec.

Once done, run pyinstaller main.spec on elevated command prompt.

这篇关于ttkbootstrap 不能与 pyinstaller 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆