pygame.init()不起作用

编程入门 行业动态 更新时间:2024-10-08 19:49:33
本文介绍了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()不起作用

本文发布于:2023-11-28 06:30:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641300.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   pygame   init

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!