当我使用时,cx_Freeze我KeyError: 'TCL_Library'在构建我的pygame程序时得到了一个keyerror .为什么我会得到这个,我该如何解决?
我的setup.py如下:
from cx_Freeze import setup, Executable
setup(
name = "Snakes and Ladders",
version = "0.9",
author = "Adam",
author_email = "Omitted",
options = {"build_exe": {"packages":["pygame"],
"include_files": ["main.py", "squares.py",
"pictures/Base Dice.png", "pictures/Dice 1.png",
"pictures/Dice 2.png", "pictures/Dice 3.png",
"pictures/Dice 4.png", "pictures/Dice 5.png",
"pictures/Dice 6.png"]}},
executables = [Executable("run.py")],
)
Run Code Online (Sandbox Code Playgroud) 我一直在拼命地试图将我的 python pygame 程序编译成独立的可执行文件,但没有成功。PyInstaller 不能与 pygame 一起正常工作,Nuitka 不能使独立运行,而 cx_Freeze 看起来是最佳选择。但是,当我使用 my 编译时setup.py,它会生成一组文件,但main可执行文件不运行。
我setup.py的如下:
import sys
import cx_Freeze
executables = [cx_Freeze.Executable("main.py")]
images =["assets/images/1.png","assets/images/2.png","assets/images/3.png","assets/images/4.png","assets/images/5.png","assets/images/6.png","assets/images/7.png","assets/images/8.png","assets/images/tile.png","assets/images/mark.png","assets/images/mine.png","assets/images/overlay.png","assets/images/overlay_2.png","assets/images/background.png"]
cx_Freeze.setup(
name="Minesweeper",
options={"build_exe": {"packages":["pygame"],
"include_files":images}},
executables = executables
)
Run Code Online (Sandbox Code Playgroud)
还有其他python文件被引用main.py; 这有关系吗?
非常感谢
编辑:根据要求,平台为 Linux (Ubuntu 14.04);python版本是3.4.3;cx_Freeze 是 cxfreeze 5.0,通过 pip 下载。确切的错误如下:
Fatal Python error: Py_Initialize: Unable to get locale encoding
Traceback (most recent call last):
File "usr/lib/python3.4/encodings/__init__.py", line 31, in <module>
ImportError: No module named 'codecs'
Aborted (core dumped)
Run Code Online (Sandbox Code Playgroud)