无法获得一个窗口,中止。运行从cython和cl编译的可执行文件时出现Kivy错误

时间:2014-07-21 12:50:36

标签: windows-7 cython python-3.3 kivy cl

我正在尝试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输出时,它在“调试”窗口中给出了这个:

[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文件时,我没有任何错误。这是我使用的命令及其输出:

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命令,但我不确切知道在哪里:(。请帮助!

感谢。 此致,PLD。

2 个答案:

答案 0 :(得分:2)

该错误意味着pygame未包含在您的编译中。

答案 1 :(得分:1)

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