Python说它找不到Pygame
在我的Python代码的顶部,我像往常一样将导入的Pygame放置,并在计算机上安装了该模块。那么,运行代码时为什么要得到这个呢?我已经尝试删除pygame并重新安装它,但它没有起作用。这些文件在我的计算机上。谁能帮我吗?
Traceback (most recent call last):
File "C:\Users\<myuser>\Documents\RPG\main.py", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
At the top of my python code, I put import pygame as usual, and have installed the module on my computer. So why do i get this when running my code? I have already tried deleting pygame and reinstalling it and it has not worked. The files are on my computer. Can anyone help me?
Traceback (most recent call last):
File "C:\Users\<myuser>\Documents\RPG\main.py", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为,安装Python时可能不会添加Python路径。如果您使用的是Windows,请搜索编辑系统环境变量。单击环境变量,在“系统变量”部分中,双击路径 - 并添加Python软件的路径。
例如: C:\ Program Files \ Python310 \ scripts \&amp; C:\ Program Files \ Python310*
I think you might not have added the python path when you installed python. If you're using windows, search for Edit the system environment variables. Click on Environment variables, in the system variables section, double click on path -- and add the path of your python software.
ex: C:\Program Files\Python310\Scripts\ & C:\Program Files\Python310*