pygame.init()不起作用 [英] Pygame.init() not working
本文介绍了pygame.init()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我成功下载了pygame,但现在下载了:
I downloaded pygame successfully but now when I do:
import pygame
pygame.init()
size = [400, 400]
pygame.display.set_mode(size)
它给出了错误:
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module> pygame.init AttributeError:
'module' object has no attribute 'init'
对我来说没有任何工作.请帮助我使用init
和display
.
And nothing is working for me. Please help me use init
and display
.
我正在使用
- python 3.4.1和
- pygame 1.9.2上
- Windows 7 32位和
-
我在上安装了pygame
- python 3.4.1 and
- pygame 1.9.2 on
- Windows 7 32bit and
I installed pygame on
c://python34/include/
推荐答案
您可能已将文件命名为pygame.py
键入时:
You probably had named your file pygame.py
when you type:
import pygame
python不会导入您想要的pygame模块,而是会尝试导入本地模块pygame-您的文件.并且您的文件没有方法 init . 尝试将文件名从 pygame.py 更改为 mypygame.py .
python won't import pygame module you want, instead it will try import local module pygame - your file. and your file hasn't method init. try change file name from pygame.py to mypygame.py.
这篇关于pygame.init()不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文