本文介绍了如何成功导入pygame.locals的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,Stackoverflowers,

Hello there Stackoverflowers,

我正在学习如何使用 Pygame 进行编程,并且正在尝试导入 pygame.locals根据我正在学习的教程,我是这样开始的;

I am learning how to program with Pygame and I am trying to import pygame.localsAccording to the tutorial I am learning from, I am starting of as such;

import pygame, sys
from pygame.locals import *

我收到此错误消息:

回溯(最近一次调用):文件C:/Python33/test.py",第 2 行,来自 pygame.locals import * ImportError: No module named 'pygame.locals'

我已经为 Python 3.2 下载了 Pygame(二进制包),目前我正在运行 3.3.当我在 Python shell 中 import pygame 时,没有返回错误,因此我相信 Pygame 已成功安装.我运行的是 Windows 7 64 位.

I have downloaded Pygame (binary package) for Python 3.2, and I am currently running 3.3.When I import pygame in the Python shell, no error is returned, and thus I am lead to believe that Pygame was successfully installed.I am running Windows 7 64 Bit.

我看过一篇关于 pygame.locals 和 Raspberry Pi 和 Linux 的类似帖子,所以我认为这篇帖子仍然相关.如果不是,请告诉我.

I've seen a similar post regarding pygame.locals and Raspberry Pi and Linux, so I think this post is still relevant. Let me know if it is not.

推荐答案

我猜你在运行脚本的当前目录中有一个名为 pygame.py 的文件.

My guess is that you have a file named pygame.py in the current directory in which you are running you script.

这篇关于如何成功导入pygame.locals的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 19:18
查看更多