Kivy 1.9.0 Windows软件包KeyError:'rthooks' [英] Kivy 1.9.0 Windows package KeyError: 'rthooks'

查看:62
本文介绍了Kivy 1.9.0 Windows软件包KeyError:'rthooks'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Windows打包我的Kivy应用程序,但出现了一些问题. 按照 kivy文档中的说明,我创建并编辑了规范文件.我既不使用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 Files\Python Kivy-1.9.0-py3.4-win32-x86\kivy34\kivy\tools\packaging\pyinstaller_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和K​​ivy 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.

无需使用 Christoph Gohlke的预编译滚轮,即可从源代码在Windows上安装Kivy 是另一个难以破解的螺母,因此在实践中,如果您真正渴望与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文档提到在顶部添加以下三行.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())中,该错误在\Lib\site-packages\kivy\tools\packaging\pyinstaller_hooks\__init__.py中定义:

The error is happening in install_hooks(globals()), which is defined at \Lib\site-packages\kivy\tools\packaging\pyinstaller_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'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆