[英]Kivy not working (Error: Unable to find any valuable Window provider.)
I have been getting this error: Unable to find any valuable Window provider.我一直收到此错误:无法找到任何有价值的 Window 提供程序。 With kivy heres the "full" error:
使用 kivy 这里是“完整”错误:
[INFO ] [Logger ] Record log in C:\Users\Victor\.kivy\logs\kivy_17-
05-27_10.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC
v.1900 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_pil, img_gif
(img_sdl2, img_ffpyplayer ignored)
[INFO ] [Text ] Provider: pil(['text_sdl2'] ignored)
[CRITICAL] [Window ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be
found.
File "C:\Users\Victor\Desktop\lib\site-packages\kivy\core\__init__.py", line
59, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\Victor\Desktop\lib\site-
packages\kivy\core\window\window_sdl2.py", line 26, in <module>
from kivy.core.window._window_sdl2 import _WindowSDL2Storage
[CRITICAL] [App ] Unable to get a Window, abort.
Exception ignored in: 'kivy.properties.dpi2px'
Traceback (most recent call last):
File "C:\Users\Victor\Desktop\lib\site-packages\kivy\utils.py", line 496, in __get__
retval = self.func(inst)
File "C:\Users\Victor\Desktop\lib\site-packages\kivy\metrics.py", line 174, in dpi
EventLoop.ensure_window()
File "C:\Users\Victor\Desktop\lib\site-packages\kivy\base.py", line 127, in ensure_window
sys.exit(1)
SystemExit: 1
[CRITICAL] [App ] Unable to get a Window, abort.
thats the error and heres the code:这就是错误,代码如下:
import kivy #added this just in case
from kivy.app import App
from kivy.uix.label import Label
class SimpleKivy(App):
def build(self):
return Label(text="Hello World!!!")
if __name__ == "__main__":
SimpleKivy().run()
Can someone explain this error有人可以解释这个错误吗
You're probably missing some dependencies.您可能缺少一些依赖项。 From the docs :
从文档:
Install the dependencies (skip gstreamer (~120MB) if not needed, see Kivy's dependencies):
安装依赖项(如果不需要,请跳过 gstreamer (~120MB),参见 Kivy 的依赖项):
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew;
python -m pip install kivy.deps.gstreamer
To install these dependencies, open up a terminal (can be a console, Pycharm Terminal window, etc.), run the first command and then the second command.要安装这些依赖项,请打开一个终端(可以是控制台、Pycharm 终端窗口等),运行第一个命令,然后运行第二个命令。
The solution above did not work for me.上面的解决方案对我不起作用。 Here is what I had to do to solve the problem on my Windows 10 pc with Anaconda Python 3.6 installed:
以下是我在安装了 Anaconda Python 3.6 的 Windows 10 电脑上解决问题所必须做的:
Even i have faced same problem.即使我也遇到过同样的问题。
Now it is working with conda install现在它正在使用 conda install
conda config --add channels conda-forge
conda install kivy
I had the same problem.我有同样的问题。 I tried many suggested solutions in vain.
我徒劳地尝试了许多建议的解决方案。 It only worked when I uninstalled and reinstalled kivy.
它仅在我卸载并重新安装 kivy 时才有效。
To uninstall:卸载:
$ pip uninstall kivy
To install:安装:
$ python -m pip install kivy==2.0.0rc1
If you are working in a virtual environment make sure that you enable the virtual environment first.in windows cmd do this如果您在虚拟环境中工作,请确保首先启用虚拟环境。在 windows cmd 中执行此操作
virtual_environment_folder_name\Scripts\activate
then run your .py file with python然后用 python 运行你的 .py 文件
python file_name.py
尝试在虚拟软件(又名 vmbox、vmware)的(>>显示>>设置)中禁用 3D 和 2D 视频加速加速。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.