0

In my python(3.4) file, I used pyglet.media module. Now I build an exe using cx_Freeze following structure of this question.My setup.py is :

from cx_Freeze import setup, Executable
setup(
    name = "program",
    version = "1.0",
    description = "test",
    executables = [Executable("program.py")])

When I run the exe, I receive this error:

ImportError: No module named 'pyglet.media'

I add import pygletat the beginning of setup.py but still doesnt work. How can I force importing pyglet.media module beside exe file?

I know there is a similar question in this link and this link, but they are either old or there is no working answer.

Community
  • 1
  • 1
Sadegh
  • 865
  • 1
  • 23
  • 47

1 Answers1

1

You should include pyglet package as options.

build_exe_options = {"packages": ["pyglet"]}

from cx_Freeze import setup, Executable

setup(
    name = "program",
    version = "1.0",
    description = "test",
    options = {"build_exe":build_exe_options},
    executables = [Executable("program.py")])
Dr.C
  • 11
  • 3