Tkinter导致SIGSEGV和系统崩溃-如何解决? [英] Tkinter causes SIGSEGV and system crash - how to fix?

查看:886
本文介绍了Tkinter导致SIGSEGV和系统崩溃-如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为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和系统崩溃-如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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