简体   繁体   English

Thonny:没有名为“pgzrun”的模块

[英]Thonny: No module named 'pgzrun'

I've been successfully using Thonny with Pygame and Pygame Zero for a while.我已经成功地将 Thonny 与 Pygame 和 Pygame 零一起使用了一段时间。 Work upgraded the PCs to 4.0.0 (Python 3.10.4) and now I get the following error:工作将 PC 升级到 4.0.0 (Python 3.10.4),现在我收到以下错误:

import pgzrun ModuleNotFoundError: No module named 'pgzrun'导入 pgzrun ModuleNotFoundError:没有名为“pgzrun”的模块

I upgraded Thonny on my own Mac and had exactly the same issue.我在自己的 Mac 上升级了 Thonny 并遇到了完全相同的问题。

Thonny's plug-ins manager shows both Pygame and Pygame Zero to be installed. Thonny 的插件管理器显示 Pygame 和 Pygame 零安装。

On my Mac, I used pip3 to install both plug-ins and the same code successfully executed from IDLE and the Terminal.在我的 Mac 上,我使用 pip3 安装了两个插件以及从 IDLE 和终端成功执行的相同代码。

Back in Thonny, I have tried changing the Python Executable to each of the available options but this does not help.回到 Thonny,我尝试将 Python Executable 更改为每个可用选项,但这无济于事。 I have also tried using Thonny's Pygame Zero mode, but this also reports that the module is missing.我也尝试过使用 Thonny 的 Pygame 零模式,但这也报告模块丢失。

Any help and advice to overcome the problem, but on Mac and Windows, would be very much appreciated.任何解决问题的帮助和建议,但在 Mac 和 Windows 上,将不胜感激。

try using the previous version of python that was installed: Run => Select interpreter => Alternative Python 3...尝试使用之前安装的 python 版本:运行 => Select 解释器 => 替代 Python 3...

Different versions of python installed would also mean different sets of installed libraries.安装的不同版本的 python 也意味着不同的安装库集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM