【发布时间】:2021-06-21 23:55:19
【问题描述】:
我有一个 Python 程序,由于它太大,这里是它的源代码链接: Link
当我在 Mac 上运行它时,有时会出现这个奇怪的异常:
Fatal Python error: PyEval_RestoreThread: the function must be called with the GIL held, but the GIL is released (the current Python thread state is NULL)
Python runtime state: initialized
Current thread 0x0000000115f8ce00 (most recent call first):
File "/usr/local/Cellar/python@3.9/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 1429 in mainloop
File ".../PyPlusSource/pyplus.py", line 1435 in <module>
那么为什么会这样呢?请用简单的话解释一下。感谢您的任何想法!
编辑:
我在 MacOS 11.2.3 Big Sur [Not beta] 上,安装了 Python 3.9.2 [Not beta again]。而且这个错误很难重现
【问题讨论】:
-
哇,我没见过这样的东西。我认为错误发生在全局解释器锁有问题的 python 解释器中。你用的是什么python版本?你运行的是什么操作系统?
-
您导入了一个名为
pygson的模块。那是什么?我在 PyPi 上找不到它。 -
打开任务管理器,查看进程占用的内存。如果增加很多,可能是内存问题。
-
您介意为我们分享一个minimal reproducible example,这样我们就不需要猜测您可能做了什么?
-
你究竟做了什么来得到这个错误?我让它运行了,没有遇到任何错误
标签: python python-3.x macos tkinter crash