Attributeerror模块pyglet.media没有属性'Player'cx_Freeze

时间:2018-01-02 19:01:44

标签: python cx-freeze attributeerror pyglet

import pyglet
import time
import random

# Program for setup audio 
while True:
    x = random.randint(600,3600)
    player = pyglet.media.Player()
    sound = pyglet.media.load('file2.mp3')
    player.queue(sound) 

    # keep playing for as long as the app is running (or you tell it to stop):
    player.eos_action = pyglet.media.SourceGroup.loop

    player.play()
    time.sleep(x)
    input("Press Enter")

并将此代码用于setup.py

from cx_Freeze import setup, Executable
import pyglet
import time
import random
import sys

base=None

if sys.platform=='win32':
    base="WIN32GUI"

includes = ['pyglet']
includes = ['time']
includes = ['random']
includes = ['sys']

setup(
    name = "Alarm",
    version = "0.1",
    description = "Alarm",
    executables = [Executable("Alarm.py")]
)

当它完成后我有一个文件夹构建,没关系。但是当我点击build文件夹中的.exe文件时, 我有这个错误:

  

Attributeerror模块pyglet.media没有属性'Player'cx_Freeze

请帮助。我该怎么办?

0 个答案:

没有答案