Python使用Pycharm开发飞机大战:AttributeError: partially initialized module ‘pygame‘ has no attribute ‘init‘

Python用Pycharm开发飞机大战初始化时遇到错误提示:AttributeError: partially initialized module 'pygame' has no attribute 'init' (most likely due to a circular import)

Python使用Pycharm开发飞机大战:AttributeError: partially initialized module ‘pygame‘ has no attribute ‘init‘

首先确认Python确认下Pygame已安装成功,使用CMD输入python确认已安装成功;

Python使用Pycharm开发飞机大战:AttributeError: partially initialized module ‘pygame‘ has no attribute ‘init‘

对于上面的错误,找了一些原因匀未解决,最后发现是文件命名为pygame了,而pygame是模块名称是否重复造成,python在查找模块时出现错误,将文件名pygame修改成任意非相同的名称即可解决。

Python使用Pycharm开发飞机大战:AttributeError: partially initialized module ‘pygame‘ has no attribute ‘init‘