Abrir um EXE do meu programa Pygame gera erros de importação
Eu criei um MP3 player com código pygame:
from Tkinter import *
import pygame
import glob
import tkFont
songs=[]
for x in glob.glob('C:\WhaleTunes\Downloaded/*mp3'):
songs.append(x)
Admin=Tk()
num=0
plpa=-1
songas=Label(Admin,text='',bg='red')
songas.place(relx=0.0,rely=0.7)
def play(number):
pygame.mixer.music.unpause()
pygame.mixer.music.load(songs[number])
pygame.mixer.music.play()
songas.configure(text=songs[number])
def pause():
pygame.mixer.music.pause()
def Pre():
global num
if num == 0:
z = len(songs)
num=z
num+=1
num-=1
play(num)
def Next():
global num
num+=1
play(num)
#init pygame mixer
pygame.mixer.init()
#atach all buttons & labels
fons=tkFont.Font(family="bold", size=40)
fon=tkFont.Font(family="Helvetica", size=20)
tit=Label(Admin,text='Mp3 Player',font=fons,fg='grey',bg='red')
tit.place(relx=0.2,rely=0.0)
playnpause=Button(Admin,text='Play',command=lambda:play(num),fg='yellow',bg='red',font=fon)
playnpause.place(relx=0.0,rely=0.4)
last=Button(Admin,text='Previous',command=Pre,fg='yellow',bg='red',font=fon)
last.place(relx=0.2,rely=0.4)
first=Button(Admin,text='Next',command=Next,fg='yellow',bg='red',font=fon)
first.place(relx=0.5,rely=0.4)
pauses=Button(Admin,text='Pause',command=pause,fg='yellow',bg='red',font=fon)
pauses.place(relx=0.7,rely=0.4)
Admin.minsize(width=500, height=200)
Admin.maxsize(width=500, height=200)
Admin.configure(bg='red')
Admin.mainloop()
E eu tentei colocá-lo em um exe com este código:
from distutils.core import setup
import py2exe
setup(console=['mp3player.py'])
Quando executo o mp3player.exe, recebo vários erros de importação:
C:\Users\P'sao\Downloads\dist\mp3player.exe:2: RuntimeWarning: import display: N
o module named _view
(ImportError: No module named _view)
C:\Users\P'sao\Downloads\dist\mp3player.exe:2: RuntimeWarning: import draw: No m
odule named _view
(ImportError: No module named _view)
C:\Users\P'sao\Downloads\dist\mp3player.exe:2: RuntimeWarning: import image: No
module named _view
(ImportError: No module named _view)
C:\Users\P'sao\Downloads\dist\mp3player.exe:2: RuntimeWarning: import pixelcopy:
No module named _view
(ImportError: No module named _view)
C:\Users\P'sao\Downloads\dist\mp3player.exe:2: RuntimeWarning: import transform:
No module named _view
(ImportError: No module named _view)
Alguém sabe como consertar isso
E quando eu compilar tudo, recebo esse erro:
The following modules appear to be missing
['AppKit', 'Foundation', 'Numeric', 'OpenGL.GL', '_scproxy', 'copyreg', 'dummy.P
rocess', 'numpy', 'pkg_resources', 'queue', 'winreg', 'pygame.sdlmain_osx']