我有以下代码:
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import pygame, random
from pygame.locals import *
pygame.init()
clock = pygame.time.Clock()
and so on
该应用程序看起来一切正常,但是当我编译代码时出现以下错误:
Traceback (most recent call last):
File "fish.py", line 4, in <module>
import pygame, random
File "/home/pi/pygame/pygame.py", line 2, in <module>
ImportError: No module named locals
------------------
(program exited with code: 1)
Press return to continue
任何人都可以帮忙吗?我是 Python 和 Linux 的新手。
我做了以下事情:
pi@raspberrypi:~$ sudo apt-get install python-pygame
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-pygame is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
pi@raspberrypi:~$