KeyError: 'TCL_Library' 当我使用 cx_Freeze

KeyError: #39;TCL_Library#39; when I use cx_Freeze(KeyError: TCL_Library 当我使用 cx_Freeze)

本文介绍了KeyError: 'TCL_Library' 当我使用 cx_Freeze的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

When I use cx_Freeze I get a keyerror KeyError: 'TCL_Library'while building my pygame program. Why do I get this and how do I fix it?

My setup.py is below:

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")],
    )

解决方案

You can work around this error by setting the environment variables manually:

set TCL_LIBRARY=C:Program FilesPython35-32	cl	cl8.6
set TK_LIBRARY=C:Program FilesPython35-32	cl	k8.6

You can also do that in the setup.py script:

os.environ['TCL_LIBRARY'] = r'C:Program FilesPython35-32	cl	cl8.6'
os.environ['TK_LIBRARY'] = r'C:Program FilesPython35-32	cl	k8.6'

setup([..])


But I found that actually running the program doesn't work. On the cx_freeze mailinglist it was mentioned:

I have looked into it already and no, it is not just a simple recompile -- or it would have been done already! :-)

It is in progress and it looks like it will take a bit of effort. Some of the code in place to handle things like extension modules inside packages is falling over -- and that may be better solved by dropping that code and forcing the package outside the zip file (another pull request that needs to be absorbed). I should have some time next week and the week following to look into this further. So all things working out well I should put out a new version of cx_Freeze before the end of the year.

But perhaps you have more luck ... Here's the bug report.

这篇关于KeyError: 'TCL_Library' 当我使用 cx_Freeze的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:KeyError: 'TCL_Library' 当我使用 cx_Freeze

基础教程推荐