问题描述
我正在为一个 python 项目开发一个 Tkinter GUI.昨天一切都很好,但是今天当我运行 mainloop() 命令时,我的 mac 立即崩溃(返回登录屏幕).
I'm developing a Tkinter GUI for a python project. Everything was fine yesterday, but today my mac immediately crashes (back to log-in screen) when I run the mainloop() command.
我试图通过减少 GUI 功能来隔离问题,但没有任何帮助.即使是最简单的 GUI 也会出现问题.
I've tried to isolate the issue by cutting back GUI features, but nothing helped. The problem even occurs with the simplest of GUIs.
我正在使用这个演示代码:
I'm using this demo code:
from tkinter import Tk, Label, Button
class MyFirstGUI:
def __init__(self, master):
self.master = master
master.title("A simple GUI")
root = Tk()
my_gui = MyFirstGUI(root)
root.mainloop()
当我运行最后一行时,我的屏幕会变黑一秒钟并返回 MacOS 登录屏幕.从终端运行脚本时也会发生.重复几次后,我发现在每次崩溃后,system.log 中都会出现这一行:
When I run the last line, my screen goes black for a second and returns the MacOS log-in screen. Also happens when running the script from terminal. After a few repeats, I found this line to recur in the system.log after at each crash:
Jul 29 17:58:51 MacBook-Pro-myname com.apple.xpc.launchd[1] (com.apple.WindowServer[1510]): Service exited due to SIGSEGV | sent by exc handler[1510]
每次崩溃的处理程序编号都是唯一的.以安全模式启动可以解决问题,但我当然不能永远处于安全模式:)
The handler number is unique to each crash. Booting in Safe Mode resolves the issue, but of course I cannot live in Safe Mode forever :)
这似乎是某种内部问题,因为 python 代码再简单不过了.我不知道如何调试这个,谁能帮帮我?
It seems some sort of internal issue, as the python code could not be simpler. I have no clue how to debug this, can anyone help me out?
已修复 - 出于某种原因,Tkinter 开始弄乱我的机器.更新到 8.6.9 解决了这个问题.(参见:https://bugs.python.org/issue34927)
FIXED IT - For some reason Tkinter started to mess with my machine. Update to 8.6.9 resolved the issue. (see: https://bugs.python.org/issue34927)
推荐答案
结果由于某种原因标准版本的 Tkinter (8.6.*) 不再正常运行.我发现 https://bugs.python.org/issue34927 并很快更新到 Tkinter 8.6.9(conda forge),这似乎已经解决了这个问题.
Turns out for some reason the standard version of Tkinter (8.6.*) was no longer functioning correctly. I found https://bugs.python.org/issue34927 and soon after updated to Tkinter 8.6.9 (conda forge), which seems to have solved the issue.
这篇关于Tkinter 导致 SIGSEGV 和系统崩溃 - 如何修复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)