无法获得窗口,中止.运行从 cython 和 cl 编译的可执行文件时出现 Kivy 错误 [英] Unable to get a Window, abort. Kivy error when running an executable compiled from cython and cl

查看:86
本文介绍了无法获得窗口,中止.运行从 cython 和 cl 编译的可执行文件时出现 Kivy 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在通过尝试 Pong Game 练习来学习 Kivy 1.8.0(在 Windows 7 上,Python 3.3.3).写完所有代码后,我想测试一下将代码编译成.exe.但是由于 PyInstaller 仅适用于 Python2.X 而不适用于 Python3.X,我已经搜索了其他解决方案.我查看了互联网并最终尝试使用 Cython 和 cl(Visual Studio 10.0)编译我的代码.编译工作正常,但是当我运行 .exe 输出时,它在调试"窗口中给了我这个:

I'm currently learning Kivy 1.8.0 (on Windows 7, Python 3.3.3) by trying the Pong Game exercise. After writing all the code, I wanted to test to compile the code to a .exe. But as PyInstaller is only available for Python2.X and not Python3.X, I've searched for another solutions. I've looked over the internet and finally tried to compile my code using Cython and cl (Visual Studio 10.0). The compilation works fine but when I run the .exe output, it gives me this in the "debug" window:

[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in C:\Users\PLD\.kivy\logs\kivy_1
4-07-21_1.txt
[INFO              ] [Factory     ] 157 symbols loaded
[DEBUG             ] [Cache       ] register <kv.lang> with limit=None, timeout=
Nones
[DEBUG             ] [Cache       ] register <kv.image> with limit=None, timeout
=60s
[DEBUG             ] [Cache       ] register <kv.atlas> with limit=None, timeout
=Nones
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif (img_py
game, img_pil ignored)
[DEBUG             ] [Cache       ] register <kv.texture> with limit=1000, timeo
ut=60s
[DEBUG             ] [Cache       ] register <kv.shader> with limit=1000, timeou
t=3600s
[DEBUG             ] [App         ] Loading kv <.\pong.kv>
[DEBUG             ] [Window      ] Ignored <egl_rpi> (import error)
[DEBUG             ] [Window      ] Ignored <pygame> (import error)
[WARNING           ] [WinPygame   ] SDL wrapper failed to import!
[DEBUG             ] [Window      ] Ignored <sdl> (import error)
[DEBUG             ] [Window      ] Ignored <x11> (import error)
[CRITICAL          ] [Window      ] Unable to find any valuable Window provider
at all!
[CRITICAL          ] [App         ] Unable to get a Window, abort.

然后退出.不知道哪里错了,知道运行原来的.py文件时,没有报错.这是我使用的命令及其输出:

And exits. I don't know what wrong, knowing that when I run the original .py file, I don't have any error. Here's the commands I used and its output:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin>vcvars32.bat
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin>cd C:/Kivy-1.8.0-py3.
3-win32

C:\Kivy-1.8.0-py3.3-win32>kivy.bat
botstrapping Kivy @ C:\Kivy-1.8.0-py3.3-win32\
Setting Environment Variables:
#################################
GST_REGISTRY
C:\Kivy-1.8.0-py3.3-win32\gstreamer\registry.bin
---------------
GST_PLUGIN_PATH:
C:\Kivy-1.8.0-py3.3-win32\gstreamer\lib\gstreamer-1.0
---------------
PATH:
C:\Kivy-1.8.0-py3.3-win32\;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy-1.8.0-py3.
3-win32\tools;C:\Kivy-1.8.0-py3.3-win32\Python33\Scripts;C:\Kivy-1.8.0-py3.3-win
32\gstreamer\bin;C:\Kivy-1.8.0-py3.3-win32\MinGW\bin;C:\Program Files (x86)\Micr
osoft F#\v4.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Deploy
;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\;C:\Program Fil
es (x86)\Microsoft Visual Studio 10.0\VC\BIN;C:\Program Files (x86)\Microsoft Vi
sual Studio 10.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\
Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visual Stu
dio 10.0\VC\VCPackages;C:\Program Files (x86)\HTML Help Workshop;C:\Program File
s (x86)\Microsoft Visual Studio 10.0\Team Tools\Performance Tools;C:\Program Fil
es (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools;C:\Program Files (x86)
\Microsoft SDKs\Windows\v7.0A\bin;C:\Kivy-1.8.0-py3.3-win32;C:\Kivy-1.8.0-py3.3-
win32\Python33;C:\Kivy-1.8.0-py3.3-win32\gstreamer\bin;C:\Kivy-1.8.0-py3.3-win32
\MinGW\bin;C:\Kivy-1.8.0-py3.3-win32;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy-
1.8.0-py3.3-win32\gstreamer\bin;C:\Kivy-1.8.0-py3.3-win32\kivy;C:\Kivy-1.8.0-py3
.3-win32;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy-1.8.0-py3.3-win32\gstreamer\
bin;C:\Kivy-1.8.0-py3.3-win32\MinGW\bin;C:\Kivy-1.8.0-py3.3-win32;C:\Kivy-1.8.0-
py3.3-win32\Python33;C:\Kivy-1.8.0-py3.3-win32\gstreamer\bin;C:\Kivy-1.8.0-py3.3
-win32\kivy;C:\Kivy-1.8.0-py3.3-win32;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy
-1.8.0-py3.3-win32\gstreamer\bin;C:\Kivy-1.8.0-py3.3-win32\MinGW\bin;C:\Kivy-1.8
.0-py3.3-win32;C:\Kivy-1.8.0-py3.3-win32\Python33;C:\Kivy-1.8.0-py3.3-win32\gstr
eamer\bin;C:\Kivy-1.8.0-py3.3-win32\kivy;C:\Windows\System32;C:\Program Files\Mi
crosoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Too
ls\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\
Satsuki Decoder Pack\Filtres
----------------------------------
PYTHONPATH:
C:\Kivy-1.8.0-py3.3-win32\kivy;
----------------------------------
##################################
done bootstraping kivy...have fun!\n

-----------------------------------------------------------------------
- Running a shell, you can browse kivyexamples and launch apps with: -
- python app.py -
-----------------------------------------------------------------------

Microsoft Windows [version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Tous droits réservés.

C:\Kivy-1.8.0-py3.3-win32>cd ../pcod/Python/Python33-Kivy/PingPongGame

C:\pcod\Python\Python33-Kivy\PingPongGame>cython main.py -o main.c --embed

C:\pcod\Python\Python33-Kivy\PingPongGame>python.exe -m cython main.py -o main.c
 --embed

C:\pcod\Python\Python33-Kivy\PingPongGame>cl.exe /nologo /Ox /MD /W3 /GS- /DNDEB
UG -Ic:\Kivy-1.8.0-py3.3-win32\Python33\include -Ic:\Kivy-1.8.0-py3.3-win32\PC m
ain.c /link /OUT:"main.exe" /SUBSYSTEM:CONSOLE /MACHINE:X86 /LIBPATH:c:\Kivy-1.8
.0-py3.3-win32\Python33\libs /LIBPATH:c:\Kivy-1.8.0-py3.3-win32\Python33\PCbuild

main.c
   Creating library main.lib and object main.exp

C:\pcod\Python\Python33-Kivy\PingPongGame>main.exe
[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in C:\Users\PLD\.kivy\logs\kivy_1
4-07-21_2.txt
[INFO              ] [Factory     ] 157 symbols loaded
[DEBUG             ] [Cache       ] register <kv.lang> with limit=None, timeout=
Nones
[DEBUG             ] [Cache       ] register <kv.image> with limit=None, timeout
=60s
[DEBUG             ] [Cache       ] register <kv.atlas> with limit=None, timeout
=Nones
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_gif (img_py
game, img_pil ignored)
[DEBUG             ] [Cache       ] register <kv.texture> with limit=1000, timeo
ut=60s
[DEBUG             ] [Cache       ] register <kv.shader> with limit=1000, timeou
t=3600s
[DEBUG             ] [App         ] Loading kv <.\pong.kv>
[DEBUG             ] [Window      ] Ignored <egl_rpi> (import error)
[DEBUG             ] [Window      ] Ignored <pygame> (import error)
[WARNING           ] [WinPygame   ] SDL wrapper failed to import!
[DEBUG             ] [Window      ] Ignored <sdl> (import error)
[DEBUG             ] [Window      ] Ignored <x11> (import error)
[CRITICAL          ] [Window      ] Unable to find any valuable Window provider
at all!
[CRITICAL          ] [App         ] Unable to get a Window, abort.

我相信问题出在 cl.exe 命令上,但我不知道具体在哪里:(.请帮忙!

I believe that the issue comes from the cl.exe command, but I don't know exactly where :(. Please, help !

谢谢.问候,PLD.

推荐答案

好吧,在阅读了一些文章和资料之后,我得出的结论是 Kivy 还没有为 Python3 做好准备.使用 Python2 版本的 Kivy 和 PyInstaller2 似乎是最简单的解决方案.

Well, after reading some articles and stuff, I came to the conclusion that Kivy is not yet ready for Python3. Using the Python2 version of Kivy and PyInstaller2 seems to be the easiest solution.

这篇关于无法获得窗口,中止.运行从 cython 和 cl 编译的可执行文件时出现 Kivy 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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