简体   繁体   中英

Run kivy 1.9.1 with SDL2 on centos 7

I am trying to make kivy work with SDL2 on centos 7 but when I run my main.py I get the following messages:

[INFO   ] [Logger      ] Record log in /home/etienne/.kivy/logs/kivy_16-01-14_51.txt
[INFO   ] [Kivy        ] v1.9.1
[INFO   ] [Python      ] v2.7.5 (default, Nov 20 2015, 02:00:19) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
[INFO   ] [Factory     ] 179 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_pil (img_pygame, img_ffpyplayer ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider at all!
egl_rpi - ImportError: cannot import name bcm
  File "/home/etienne/Demo/Test/test_virtualenv/lib/python2.7/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "/home/etienne/Demo/Test/test_virtualenv/lib/python2.7/site-packages/kivy/core/window/window_egl_rpi.py", line 12, in <module>
    from kivy.lib.vidcore_lite import bcm, egl

pygame - ImportError: No module named pygame
  File "/home/etienne/Demo/Test/test_virtualenv/lib/python2.7/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "/home/etienne/Demo/Test/test_virtualenv/lib/python2.7/site-packages/kivy/core/window/window_pygame.py", line 8, in <module>
    import pygame

x11 - ImportError: No module named window_x11
  File "/home/etienne/Demo/Test/test_virtualenv/lib/python2.7/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)

[INFO   ] [Text        ] Provider: pil(['text_pygame'] ignored)
[CRITICAL] [App         ] Unable to get a Window, abort.
 Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored
[CRITICAL] [App         ] Unable to get a Window, abort.
 Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored
[CRITICAL] [App         ] Unable to get a Window, abort.
 Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored
[CRITICAL] [App         ] Unable to get a Window, abort.

I have installed the following libraries:

SDL.x86_64                            1.2.15-14.el7                  @base      
SDL-devel.x86_64                      1.2.15-14.el7                  @base      
SDL2.x86_64                           2.0.3-9.el7                    @epel      
SDL2-devel.x86_64                     2.0.3-9.el7                    @epel      
SDL_image.x86_64                      1.2.12-11.el7                  @epel      
SDL_mixer.x86_64                      1.2.12-4.el7                   @epel      
SDL_mixer-devel.x86_64                1.2.12-4.el7                   @epel      
SDL_ttf.x86_64                        2.0.11-6.el7                   @epel      
SDL_ttf-devel.x86_64                  2.0.11-6.el7                   @epel   

I make it work with the same main.py on Fedora 20 and it also work if I install pygame but he is too heavy so I would like to use SDL2.
If you have any idea on how to make it work ;)

Since you installed kivy yourself inside your virtual environment, it was compiled at the installation time. Kivy detects available libraries when it is compiled. If you installed SDL2 libs after that, kivy will not have SDL2 support right away. You should reinstall kivy with

pip install --upgrade --force-reinstall kivy

You may notice that SDL2 libs are detected correctly in the beginning of console output while it is installing. And after that you should see SDL2 providers available, when you run the app:

[INFO   ] [Logger      ] Record log in /home/u1/.kivy/logs/kivy_16-06-03_4.txt
[INFO   ] [Kivy        ] v1.9.1
[INFO   ] [Python      ] v2.7.10 (default, May 24 2015, 14:46:10) [GCC]
[INFO   ] [Factory     ] 179 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)

Had the same problem- this was the line that worked for me at the end

python3.5 -m pip install kivy --no-use-wheel

This forced pip to compile kivy and find sdl2...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM