gpt4 book ai didi

python - 在 centos 7 上使用 SDL2 运行 kivy 1.9.1

转载 作者:行者123 更新时间:2023-11-28 19:14:53 25 4
gpt4 key购买 nike

我试图让 kivy 在 centos 7 上与 SDL2 一起工作,但是当我运行我的 main.py 时,我收到以下消息:

[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.

我已经安装了以下库:

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

我让它在 Fedora 20 上与相同的 main.py 一起工作,如果我安装 pygame 它也能工作,但他太重了所以我想使用 SDL2。
如果您对如何让它发挥作用有任何想法;)

最佳答案

因为你在你的虚拟环境中自己安装了kivy,它在安装时被编译了。 Kivy 在编译时检测可用的库。如果你在那之后安装了 SDL2 库,kivy 将不会立即支持 SDL2。你应该用

重新安装 kivy
pip install --upgrade --force-reinstall kivy

您可能会注意到,在安装过程中,SDL2 库在控制台输出的开头被正确检测到。之后,当您运行该应用程序时,您应该会看到可用的 SDL2 提供程序:

[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)

关于python - 在 centos 7 上使用 SDL2 运行 kivy 1.9.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34794417/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com