python - pygame 命令都不起作用;如,它说它们不存在
问题描述
我正在使用 VS 代码,我已经使用 pip 下载了 pygame,我可以看到它已经安装(版本 2.0.1)但是当我将它导入 python 文件并尝试用它做任何事情时,我被告知pygame 没有模块 _____。init
QUIT
任何按键命令都会发生这种情况。当我这样做时,import pygame; print(pygame)
我得到:
pygame 2.0.1 (SDL 2.0.14, Python 3.9.1)
Hello from the pygame community. https://www.pygame.org/contribute.html
<module 'pygame' from 'C:\\Users\\James\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\pygame\\__init__.py'>
当我这样做时,print(dir(pygame))
我会得到一个非常长的命令列表,其中我之前所说的命令不起作用。我没有另一个名为 pygame 的文件夹/目录,我看到其他人认为这可能是问题所在。其他人说我需要对 VS 代码文件做一些事情,但我真的不明白他们在说什么。
另外我觉得值得注意的是,我之前在 VS 代码中使用过 pygame,但我删除并重新安装了 python,因为我安装了两个不同的版本,这只是破坏了事情。pygame 在我删除 python 之前停止工作,但在那种情况下,它no module called pygame
说它不再这么说,但正如我之前所说,pygames 命令都不起作用
任何帮助将不胜感激
解决方案
推荐阅读
- python - Flask Restful reqparse add_argument 类型为二进制
- c++ - 为什么 Crypto++ SecByteBlock 下标有效
- java - JavaFX TreeItem.TreeModificationEvent
事件不提供对 (ListChangeListener.Change) 更改成员的访问以获取订购信息 - vue.js - Mixin 中的 VueX
- r - 在延迟微分方程中使用积分函数
- windows - 使用 PySpark 内核时出现 Jupyter Notebook 错误:代码因致命错误而失败:发送 http 请求时出错
- javascript - 此正则表达式与小数点后的 0 不匹配
- jquery - 我使用 Highcharts 创建了一个散点图,但 point.z 值未显示在工具提示中
- qt - Qt 方法 logicalDpiX() 不应该为相同分辨率但不同大小的屏幕返回不同的值吗?
- javascript - 设置超时,运行函数然后刷新页面