我有以下代碼:pygame的 - 導入錯誤:沒有模塊名爲當地人樹莓派
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import pygame, random
from pygame.locals import *
pygame.init()
clock = pygame.time.Clock()
and so on
的應用程序都將出現OK,但是當我編譯代碼我收到以下錯誤:
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的新手。
我已經做了以下內容:
[email protected]:~$ 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.
[email protected]:~$
呃它的不叫其fish.py – 2012-08-14 09:25:44
你發佈的錯誤說'/home/pi/pygame/pygame.py「,所以我想你的文件被稱爲'pygame.py',並在目錄' /家庭/ PI/pygame'。 – sloth 2012-08-14 09:26:23
@WelshKing所以,你必須在*目錄另一個*文件,它的名字叫做'pygame.py' – sloth 2012-08-14 09:31:21