Pygameの使用中にエラーが発生しました。 私はPython 3.5とPygame 3.2を使用しています。私はちょうど今日pygameのを学ぶために始めた、それは私に、このエラーを与える:pygame(pygame.init())のエラー
コード:
import pygame
pygame.init()
width, height = 640, 480
screen=pygame.display.set_mode((width, height))
player = pygame.image.load("resources/images/dude.png")
while 1:
screen.fill(0)
screen.blit(player, (100,100))
pygame.display.flip()
for event in pygame.event.get():
if event.type==pygame.QUIT:
pygame.quit()
exit(0)
ERROR:
Traceback (most recent call last):
File "test.py", line 5, in <module>
pygame.init()
AttributeError: module 'pygame' has no attribute 'init'
[pygameの属性と、init()](HTTPの可能性のある重複:// stackoverflowの。 com/questions/19912810/pygame-attribute-init) – Ares
pygameはどのようにインストールしましたか? [この回答](http://stackoverflow.com/a/34344103/4014959)_may_ help。もう一つの可能性は、実際のpygameモジュールをシャドーイングしている 'test.py'を実行しているディレクトリ(またはPYTHONPATHの他の場所)に' pygame.py'という名前のスクリプトがあることです。 –