Python pygame exe build with cx_freeze error TCL_LIBRARY

I follow this tutorial here to make a snake game in pygame. Here is my setup.py code:

import cx_Freeze

executables = [cx_Freeze.Executable("snake.py")]

cx_Freeze.setup(
    name="Snake",
    options={"build_exe":{"packages":["pygame"], "include_files":["apple.png","Aenemy.png","bomb.png","cherry.png","enemy.png","fire.png","iceimg.png","snakebod(2).png","snakebod.png","Explosion.wav","Explosion2.wav","jump.wav","Pickup_Coin.wav","Powerup.wav","openingsong.mp3","highscores.txt",]}},

    description = "Snake Game made in python with pygame.",
    executables = executables
    )

When I try to create this on the command line, I get this error

C: \ Users \ Accounts \ Documents \ snake> C: / Python35 / python setup.py build running build running build_exe File "C: \ Python35 \ lib \ site-packages \ cx_Freeze \ hooks.py", line 597, in load_tkinter tclSourceDir = os.environ ["TCL_LIBRARY"]

File "C: \ Python35 \ lib \ os.py", line 681, in getitem raise KeyError (key) from None KeyError: 'TCL_LIBRARY'KeyError:' TCL_LIBRARY '

and it is not built. Does anyone know how to fix this? Thanks

+4
1

! setup.py

import os
os.environ['TCL_LIBRARY'] = "C:\\Program Files\\Python35\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Program Files\\Python35\\tcl\\tk8.6"

C:\Program Files\Python35\tcl\tcl8.6 C:\Program Files\Python35\tcl\tk8.6 tcl8.6 tk8.6 .

+9

Source: https://habr.com/ru/post/1625442/


All Articles