且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么我会收到这个 AttributeError ?(python3,pygame)

更新时间:2023-02-14 21:54:13

您正在使用另一个 pygame.py 文件遮蔽pygame 库,可能与 gamephysics.py 位于同一位置.

You are shadowing the pygame library with another pygame.py file, probably in the same location as gamephysics.py.

打印出违规模块的文件路径:

Print out the file path of the offending module:

import pygame

print('Path to pygame module:', pygame.__file__)

这将显示rogue"模块的位置.找到后,将其重命名为其他名称.

This will you show you where the 'rogue' module is located. Once you find it, rename it to something else.