【发布时间】:2021-09-02 08:46:37
【问题描述】:
我用 pygame 为一个大学项目编写了一个钟摆模拟,我想让用户看到带有 matplotlib 窗口的图形。当我从 vscode 运行它时,它运行完美,但是当我直接从终端运行它并尝试查看它给我的图表时:
Fatal Python error: PyEval_SaveThread: 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 0x00007f00b05ac740 (most recent call first):
File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 1649 in main
File "/home/estevao/.local/lib/python3.9/site-packages/matplotlib/backends/backend_gtk3.py", line 850 in mainloop
File "/home/estevao/.local/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 3595 in show
File "/home/estevao/.local/lib/python3.9/site-packages/matplotlib/pyplot.py", line 378 in show
File "/home/estevao/Projetos/Pendulum/Estev\xe3o_Projeto1.py", line 27 in export_graph
File "/home/estevao/.local/lib/python3.9/site-packages/pygame_menu/widgets/core/widget.py", line 1230 in apply
File "/home/estevao/.local/lib/python3.9/site-packages/pygame_menu/widgets/widget/button.py", line 247 in update
File "/home/estevao/.local/lib/python3.9/site-packages/pygame_menu/menu.py", line 2322 in update
File "/home/estevao/Projetos/Pendulum/Estev\xe3o_Projeto1.py", line 325 in <module>
您知道我该如何解决吗?我可以上传整个代码,但它充满了混乱,而且足够大,如果你看到它,你不太可能帮助我。
【问题讨论】:
标签: python python-3.x matplotlib pygame gil