python - Python 3.7.7 Kivy:找不到任何有价值的 Window 提供程序。sdl2 - ValueError:不是布尔值:400
问题描述
我被这个问题困住了。我试图安装我在互联网上找到的所有先决条件。我正在使用 Windows 10 和 CMDer。这个错误也发生在我运行的任何 Kivy 程序中。这是错误详细信息。
(kivy_venv) λ python main.py -d
[INFO ] [Logger ] Record log in C:\Users\DC\.kivy\logs\kivy_20-04-05_71.txt
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.1.18
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.1.10
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.1.23
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "D:\Fazar\Terminal\kivy_venv\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "D:\Fazar\Terminal\kivy_venv\Scripts\python.exe"
[INFO ] [Factory ] 184 symbols loaded
[DEBUG ] [Cache ] register <kv.lang> with limit=None, timeout=None
[DEBUG ] [Cache ] register <kv.image> with limit=None, timeout=60
[DEBUG ] [Cache ] register <kv.atlas> with limit=None, timeout=None
[INFO ] [ImageLoaderFFPy] Using ffpyplayer 4.3.1
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer, img_gif
[DEBUG ] [Cache ] register <kv.texture> with limit=1000, timeout=60
[DEBUG ] [Cache ] register <kv.shader> with limit=1000, timeout=3600
[DEBUG ] [App ] Loading kv <.\pong.kv>
[INFO ] [Window ] Provider: sdl2
[CRITICAL] [Window ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - ValueError: Not a boolean: 400
File "D:\Fazar\Terminal\kivy_venv\lib\site-packages\kivy\core\__init__.py", line 71, in core_select_lib
cls = cls()
File "D:\Fazar\Terminal\kivy_venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 152, in __init__
super(WindowSDL, self).__init__()
File "D:\Fazar\Terminal\kivy_venv\lib\site-packages\kivy\core\window\__init__.py", line 981, in __init__
self.create_window()
File "D:\Fazar\Terminal\kivy_venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 284, in create_window
resizable = Config.getboolean('graphics', 'resizable')
File "D:\Fazar\Software\Python37\lib\configparser.py", line 828, in getboolean
raw=raw, vars=vars, fallback=fallback, **kwargs)
File "D:\Fazar\Software\Python37\lib\configparser.py", line 808, in _get_conv
**kwargs)
File "D:\Fazar\Software\Python37\lib\configparser.py", line 802, in _get
return conv(self.get(section, option, **kwargs))
File "D:\Fazar\Software\Python37\lib\configparser.py", line 1160, in _convert_to_boolean
raise ValueError('Not a boolean: %s' % value)
[CRITICAL] [App ] Unable to get a Window, abort.
我已经安装了 pygments、pypiwin32、kivy_deps.sdl2、kivy_deps.angle、kivy_deps.gstreamer 和 Kivy 本身。我现在一点头绪都没有。如果您有解决此问题的建议,请回答。
注意:Kivy 程序之前运行成功,现在它不再工作了,我尝试在虚拟环境内外重新安装 Python 3.7.7 和 Kivy 几次
解决方案
通过配置修复的错误C:\Users\<UserName>\.kivy\config.ini
:
[graphics]
display = -1
fullscreen = 0
height = 600
left = 0
maxfps = 60
multisamples = 2
position = auto
rotation = 0
show_cursor = 1
top = 0
width = 800
resizable = 1
borderless = 0
window_state = visible
minimum_width = 0
minimum_height = 0
min_state_time = .035
allow_screensaver = 1
shaped = 0
resizable 值必须是 1 或 0。否则可能会导致 Windows 提供程序错误。此外,安装 preresquisites 以避免另一个错误:
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew kivy.deps.angle
python -m pip install kivy_deps.gstreamer
推荐阅读
- antlr4 - Xcode 警告:_startToken(startToken) 将在 _deleteConfigs(deleteConfigs) 之后初始化
- javascript - 如何在 gatsby 项目中包含自定义 javascript 文件?
- java - 是否可以使用 ByteBuddy 更改注释的值?
- javascript - 使用 babel-polyfill 后,classList.replace() 不是 IE11 中的方法或属性
- vba - 如何使用硬编码的月份和当前年份进行查询
- json - 使用 .values() 序列化模型,但也包括 ManyToMany 相关字段
- php - 无法使用 ContainerAware 命令功能调试 Symfony
- java - RecyclerView Adapter 不会膨胀正确的布局
- sql - 在 SQL Server 中运行过程的 IF 条件
- c - 试图用 sigaction 调用处理程序捕获 SIGINT 但仍然杀死进程