简体   繁体   English

Python 3 pygame:无法导入pygame

[英]Python 3 pygame: cannot import pygame

I tried to make this snake game, but it said the following error when I imported pygame: 我尝试制作此蛇游戏,但在导入pygame时显示以下错误:

ModuleNotFoundError: No module named 'pygame' ModuleNotFoundError:没有名为“ pygame”的模块

What should I do? 我该怎么办?

frist see if pygame is installed using 首先查看pygame是否使用

pip3 freeze

if not, then install it: 如果没有,则安装它:

pip3 install pygame

now import pygame won't raise error. 现在import pygame不会引发错误。

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

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