本文介绍了Kivy 错误(python 2.7):sdl2 导入错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 Python 2.7 项目中使用 kivy(在 PyCharm - Windows 10 环境中),但出现以下错误.

如果有人可以帮助我?谢谢!

PS:我尝试了很多次卸载/重新安装库等,并按照类似帖子中的建议进行操作,但它不起作用:

I'm trying to use kivy on my Python 2.7 project (in a PyCharm - Windows 10 environment), but I get the following error.

If someone can help me ? Thanks !

PS : I tried many times uninstalling/reinstalling libraries etc and doing what suggested on posts like this one, but it doesn't work : Kivy not working (Error: Unable to find any valuable Window provider.)

[INFO   ] [Logger      ] Record log in C:Userscyril.kivylogskivy_18-03-25_0.txt
 C:Userscyrilvenvlibsite-packageskivymodules\__init__.py:128: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
   if path not in sys.path:
[INFO   ] [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   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif (img_sdl2, img_pil, img_ffpyplayer ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: Le module sp�cifi� est introuvable.
  File "C:Userscyrilvenvlibsite-packageskivycore\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:Userscyrilvenvlibsite-packageskivycorewindowwindow_sdl2.py", line 26, in <module>
    from kivy.core.window._window_sdl2 import _WindowSDL2Storage

[CRITICAL] [App         ] Unable to get a Window, abort.

Process finished with exit code 1
解决方案

Problem

It is looking for the Kivy dependencies (e.g. sdl2) in your virtualenv.

Solution

I have encountered the same problem. I did the following and it solved the problem.

Environment

  • Windows 10
  • PyCharm Community
  • Python 3.5
  • Kivy dependencies installed (docutils, pygments, pypiwin32, kivy.deps.sdl2, kivy.deps.glew, kivy.deps.gstreamer) and for Python 3.5+ (kivy.deps.angle)

PyCharm IDE

  1. Open the project
  2. Click File
  3. Click Settings...
  4. Click Project Interpreter
  5. On the right panel, click the drop down list for Project Interpreter
  6. Select the location where the Python interpreter is installed e.g. C:Usersuser-nameAppDataLocalProgramsPythonPython35python.exe
  7. Click OK until you exit the Settings window
  8. Run your program

Output

这篇关于Kivy 错误(python 2.7):sdl2 导入错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 12:49
查看更多