Spyder没有运行Kivy脚本

时间:2018-03-10 05:38:30

标签: python kivy spyder

我使用kivy在python 2.7上编写了一个脚本。当我在python IDLE中运行程序时,它工作正常,但当我在Spyder中运行时,我收到以下错误:

runfile('C:/Users/Roelof/Documents/ubuntu_share/plate_count_program/script.py', wdir='C:/Users/Roelof/Documents/ubuntu_share/plate_count_program')
[INFO   ] [Logger      ] Record log in C:\Users\Roelof\.kivy\logs\kivy_18-03-10_12.txt
INFO:kivy:[Logger      ] Record log in C:\Users\Roelof\.kivy\logs\kivy_18-03-10_12.txt
[INFO   ] [Kivy        ] v1.10.0
INFO:kivy:[Kivy        ] v1.10.0
[INFO   ] [Python      ] v2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
INFO:kivy:[Python      ] v2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
[INFO   ] [Factory     ] 194 symbols loaded
INFO:kivy:[Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
INFO:kivy:[Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
INFO:kivy:[Text        ] Provider: sdl2
[INFO   ] [OSC         ] using <thread> for socket
INFO:kivy:[OSC         ] using <thread> for socket
[INFO   ] [Window      ] Provider: sdl2
INFO:kivy:[Window      ] Provider: sdl2
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:\Python27\lib\site-packages\kivy\core\__init__.py", line 67, in core_select_lib
    cls = cls()
  File "C:\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__
    super(WindowSDL, self).__init__()
  File "C:\Python27\lib\site-packages\kivy\core\window\__init__.py", line 899, in __init__
    self.create_window()
  File "C:\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 269, in create_window
    self.fullscreen, resizable, state)
  File "kivy\core\window\_window_sdl2.pyx", line 110, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivy\core/window\_window_sdl2.c:2436)
  File "kivy\graphics\cgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name (kivy\graphics\cgl.c:3044)
  File "kivy\graphics\cgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name (kivy\graphics\cgl.c:2879)
  File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)

CRITICAL:kivy:[Window      ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:\Python27\lib\site-packages\kivy\core\__init__.py", line 67, in core_select_lib
    cls = cls()
  File "C:\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__
    super(WindowSDL, self).__init__()
  File "C:\Python27\lib\site-packages\kivy\core\window\__init__.py", line 899, in __init__
    self.create_window()
  File "C:\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 269, in create_window
    self.fullscreen, resizable, state)
  File "kivy\core\window\_window_sdl2.pyx", line 110, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivy\core/window\_window_sdl2.c:2436)
  File "kivy\graphics\cgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name (kivy\graphics\cgl.c:3044)
  File "kivy\graphics\cgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name (kivy\graphics\cgl.c:2879)
  File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)

[CRITICAL] [App         ] Unable to get a Window, abort.
CRITICAL:kivy:[App         ] Unable to get a Window, abort.
An exception has occurred, use %tb to see the full traceback.

有人有什么想法吗?我认为这可能是kivy依赖的东西,但我已经安装了它们。

2 个答案:

答案 0 :(得分:0)

Spyder维护者)这个错误已经好几次reported

它将在我们的 3.2.8 版本中修复,不久将会发布。

答案 1 :(得分:0)

在运行并关闭应用程序后,在python控制台上单击X按钮。这将打开一个新的python控制台。然后,您可以毫无问题地运行程序。

或: Ctrl + T