Pygame 已安装;但是,python 终端显示“没有名为‘pygame’的模块”(Ubuntu 20.04.1)
- 2025-02-14 09:50:00
- admin 原创
- 62
问题描述:
我正在使用 Ubuntu 20.04.1 LTS。我已经使用sudo apt-get install python-pygame安装了 pygame 。但是,当我使用 VS 代码运行代码时,python 终端给出以下输出:
Traceback (most recent call last):
File "path", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
我尝试使用相同的命令重新安装 Pygame。输出如下:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-pygame is already the newest version (1.9.6+dfsg-2build1).
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
基本上,我已经安装了 pygame。那么您认为可能是什么原因呢?我的 Python 版本是 3.8.2。
提前致谢!
解决方案 1:
尚未发布适用于 Python 3.8.2 的 pygame 1.9.6 版本。安装开发版本:
python3 -m pip install pygame==2.0.0.dev10
相关推荐
热门文章
项目管理软件有哪些?
热门标签
云禅道AD