• <bdo id='zaUNE'></bdo><ul id='zaUNE'></ul>
      <tfoot id='zaUNE'></tfoot>

    1. <legend id='zaUNE'><style id='zaUNE'><dir id='zaUNE'><q id='zaUNE'></q></dir></style></legend>

        <small id='zaUNE'></small><noframes id='zaUNE'>

        <i id='zaUNE'><tr id='zaUNE'><dt id='zaUNE'><q id='zaUNE'><span id='zaUNE'><b id='zaUNE'><form id='zaUNE'><ins id='zaUNE'></ins><ul id='zaUNE'></ul><sub id='zaUNE'></sub></form><legend id='zaUNE'></legend><bdo id='zaUNE'><pre id='zaUNE'><center id='zaUNE'></center></pre></bdo></b><th id='zaUNE'></th></span></q></dt></tr></i><div id='zaUNE'><tfoot id='zaUNE'></tfoot><dl id='zaUNE'><fieldset id='zaUNE'></fieldset></dl></div>

      1. Kivy 1.9.0 Windows 包 KeyError: 'rthooks'

        时间:2023-10-10

            <bdo id='keU7h'></bdo><ul id='keU7h'></ul>

              1. <small id='keU7h'></small><noframes id='keU7h'>

              2. <i id='keU7h'><tr id='keU7h'><dt id='keU7h'><q id='keU7h'><span id='keU7h'><b id='keU7h'><form id='keU7h'><ins id='keU7h'></ins><ul id='keU7h'></ul><sub id='keU7h'></sub></form><legend id='keU7h'></legend><bdo id='keU7h'><pre id='keU7h'><center id='keU7h'></center></pre></bdo></b><th id='keU7h'></th></span></q></dt></tr></i><div id='keU7h'><tfoot id='keU7h'></tfoot><dl id='keU7h'><fieldset id='keU7h'></fieldset></dl></div>
                    <tbody id='keU7h'></tbody>

                  <tfoot id='keU7h'></tfoot><legend id='keU7h'><style id='keU7h'><dir id='keU7h'><q id='keU7h'></q></dir></style></legend>
                  本文介绍了Kivy 1.9.0 Windows 包 KeyError: 'rthooks'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试为 Windows 打包我的 Kivy 应用程序,但遇到了一些问题.按照 kivy docs 中的说明,我创建并编辑了规范文件.我既不使用 pygame 也不使用 SDL2(我的意思是我不直接导入它们来运行我的程序),但在 Kivy 日志中我看到 pygame 仍然提供我的窗口:

                  I'm trying to package my Kivy app for Windows, but I'm having some issues. Following the instructions in the kivy docs, I created and edited the spec file. I don't use neither pygame nor SDL2 (I mean I don't import them directly to run my program), but in the Kivy log I see pygame still provides my window:

                  [INFO              ] [Text        ] Provider: pygame
                  [INFO              ] [Window      ] Provider: pygame
                  

                  我不明白为什么,因为我使用的是 kivy 1.9.0.

                  I don't understand why, since I'm using kivy 1.9.0.

                  也就是说,我在构建规范时遇到了这个问题:

                  Said that, I'm having this problem when building the spec:

                  (...)
                  202 WARNING: stderr:    File "C:Program FilesPython Kivy-1.9.0-py3.4-win32-x86kivy34kivy	oolspackagingpyinstaller_hooks\__init__.py", line 13, in install_hooks
                      sym['rthooks']['kivy'] = [join(curdir, 'rt-hook-kivy.py')]
                  202 WARNING: stderr:    sym['rthooks']['kivy'] = [join(curdir, 'rt-hook-kivy.py')]
                      KeyError: 'rthooks'
                  202 WARNING: stderr: KeyError: 'rthooks'
                  

                  我对编辑规范有点困惑(我需要导入 pygame/SDL2?),这可能是我的问题.我正在使用 Windows 7 x86、Python 3.4.3 和 Kivy 1.9.0.任何帮助表示赞赏.

                  I'm a little confused about editing the spec (I need to import pygame/SDL2?), and that's probably my problem. I'm using Windows 7 x86, Python 3.4.3 and Kivy 1.9.0. Any help is appreciated.

                  推荐答案

                  2015 年 10 月 1 日更新:

                  事实证明这是一个错误.截至 2015 年 9 月 24 日的最新进展Kivy 版本应该没有这个问题.

                  It turns out this is a bug. As of 24 September 2015 the latest development version of Kivy should be free of this issue.

                  从源代码在 Windows 上安装 Kivy,不使用 Christoph Gohlke 的预编译轮子,虽然是另一个难以破解的难题,所以在实践中,如果你真的渴望 Python 3.x 兼容性,可能最简单的方法是等到 Kivy 团队发布 1.9.0 之后的另一个版本,然后 Gohlke 的脚本生成简单的- 安装二进制文件.

                  Installing Kivy on Windows from source code, without the use of Christoph Gohlke's pre-compiled wheels, is another tough nut to crack though, so in practice if you truly crave Python 3.x compatibility it may be easiest to wait until the Kivy team issues another release past 1.9.0, and Gohlke's script to generate the easy-to-install binary.

                  我已经部分解决了这个问题:

                  I've partially troubleshooted this:

                  您引用的 kivy docs 提到将以下三行添加到顶部.spec 文件:

                  The kivy docs you reference mention adding the following three lines to the top of the .spec file:

                  from kivy.tools.packaging.pyinstaller_hooks import install_hooks
                  import os
                  install_hooks(globals())
                  

                  错误发生在 install_hooks(globals()) 中,定义在 Libsite-packageskivy oolspackagingpyinstaller_hooks\__init__.py:

                  The error is happening in install_hooks(globals()), which is defined at Libsite-packageskivy oolspackagingpyinstaller_hooks\__init__.py:

                  from os.path import dirname, join
                  from functools import partial
                  
                  curdir = dirname(__file__)
                  
                  def install_hooks(sym, hookspath=None):
                  
                      _hookspath = [curdir]
                      if hookspath is not None:
                          _hookspath += hookspath
                  
                      sym['rthooks']['kivy'] = [join(curdir, 'rt-hook-kivy.py')]
                      sym['Analysis'] = partial(sym['Analysis'], hookspath=_hookspath)
                  

                  但倒数第二行导致消息:WARNING: stderr: KeyError: 'rthooks'.

                  But the second last line is causing the message: WARNING: stderr: KeyError: 'rthooks'.

                  所以看起来它期望一个变量 rthooks 在全局命名空间中,但事实并非如此.

                  So it looks like it's expecting a variable rthooks to be in the global namespace, but it's not.

                  我不确定下一步该做什么.

                  I'm not sure what to do next.

                  这篇关于Kivy 1.9.0 Windows 包 KeyError: 'rthooks'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Python Kivy:如何在按钮单击时调用函数? 下一篇:Discord.py discord.NotFound 异常

                  相关文章

                  最新文章

                    <bdo id='pza7n'></bdo><ul id='pza7n'></ul>
                • <legend id='pza7n'><style id='pza7n'><dir id='pza7n'><q id='pza7n'></q></dir></style></legend>
                • <tfoot id='pza7n'></tfoot>
                  <i id='pza7n'><tr id='pza7n'><dt id='pza7n'><q id='pza7n'><span id='pza7n'><b id='pza7n'><form id='pza7n'><ins id='pza7n'></ins><ul id='pza7n'></ul><sub id='pza7n'></sub></form><legend id='pza7n'></legend><bdo id='pza7n'><pre id='pza7n'><center id='pza7n'></center></pre></bdo></b><th id='pza7n'></th></span></q></dt></tr></i><div id='pza7n'><tfoot id='pza7n'></tfoot><dl id='pza7n'><fieldset id='pza7n'></fieldset></dl></div>

                  <small id='pza7n'></small><noframes id='pza7n'>