Some initial information:
I have windows 10 on my computer and all programs are 64-bit versions.
I'm writting a game in python (3.6.1) using tkinter and now I would like to convert it to .exe. I have used cx_freeze (5.0.1) and it made the build, but when I try to open the game a window opens and then closes immediately. Therefore I tried to open it via cmd and the following error pops up:
File "sliks.py", line 1, in <module>
File "C:UsersTinkaAppDataLocalProgramsPythonPython36libkinter\__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: DLL load failed: The specified module could not be found.
I have checked tkinter support as it says here:
https://wiki.python.org/moin/TkInter
and no error occurs.
Also I have tried to install tk-dev with pip as it says in some answers on this subject but nothing happens as I get this message:
C:WINDOWSsystem32>pip install tk-dev
Collecting tk-dev
Could not find a version that satisfies the requirement tk-dev (from versions: )
No matching distribution found for tk-dev
I never had any python 2.x on my computer so there are no mixed up libraries as in this case: ImportError DLL load failed importing _tkinter
Here is my setup.py file I have used for cx_freeze in case there is something wrong with that:
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = r'C:UsersTinkaAppDataLocalProgramsPythonPython36clcl8.6'
os.environ['TK_LIBRARY'] = r'C:UsersTinkaAppDataLocalProgramsPythonPython36clk8.6'
base = None
setup(
name = "Six",
version = "0.1",
options = {"build_exe": {"packages": ["tkinter"]}},
executables = [Executable("sliks.py", base=base)]
)
Any ideas what could be the problem? I know there are many opened questions on this subject, but I have tried most of the solutions and had no luck.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…