问题
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:\Users\cyril\.kivy\logs\kivy_18-03-25_0.txt
C:\Users\cyril\venv\lib\site-packages\kivy\modules\__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:\Users\cyril\venv\lib\site-packages\kivy\core\__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "C:\Users\cyril\venv\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.
Process finished with exit code 1
回答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
- Open the project
- Click File
- Click Settings...
- Click Project Interpreter
- On the right panel, click the drop down list for Project Interpreter
- Select the location where the Python interpreter is installed e.g. C:\Users\user-name\AppData\Local\Programs\Python\Python35\python.exe
- Click OK until you exit the Settings window
- Run your program
Output
回答2:
Thank you so much, it did work ! I just added the "original" python interpreter installed in C:\Python27\python.exe in Project Interpreter list and selected it like you said.
Best regards,
来源:https://stackoverflow.com/questions/49466785/kivy-error-python-2-7-sdl2-import-error