Python使用pygame: AttributeError: partially initialized module 'pygame' has no attribute 'init'

python导入pycharm,调用init()时报错

AttributeError: partially initialized module 'pygame' has no attribute 'init' (most likely due to a circular import)

原因是:文件名命名为pygame,如果跟关键字pygame一样,import pygame时,导入的是模块名

把模块名pygame改成其他名字即可,如test.py

你可能感兴趣的:(Python使用pygame: AttributeError: partially initialized module 'pygame' has no attribute 'init')