Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
233 views
in Technique[技术] by (71.8m points)

python - Kivy errors on a new Windows 10 (same code worked fine on an old Mac)

I get the following errors when running a python file using kivy on a new Windows 10:

C:UsersMeAppDataLocalProgramsPythonPython36-32python.exe C:/Users/Me/Desktop/PycharmProjects/music_game_kivy/music_game_kivy.py
[INFO   ] [Logger      ] Record log in C:UsersMe.kivylogskivy_17-12-26_10.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 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] [Text        ] Unable to find any valuable Text provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:UsersMeAppDataLocalProgramsPythonPython36-32libsite-packageskivycore\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:UsersMeAppDataLocalProgramsPythonPython36-32libsite-packageskivycore	ext	ext_sdl2.py", line 12, in <module>
    from kivy.core.text._text_sdl2 import (_SurfaceContainer, _get_extents,

pil - ModuleNotFoundError: No module named 'PIL'
  File "C:UsersMeAppDataLocalProgramsPythonPython36-32libsite-packageskivycore\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:UsersMeAppDataLocalProgramsPythonPython36-32libsite-packageskivycore	ext	ext_pil.py", line 7, in <module>
    from PIL import Image, ImageFont, ImageDraw

[CRITICAL] [App         ] Unable to get a Text provider, abort.

Process finished with exit code 1

The exact same python file was running just fine on my old Mac. I'm not posting the entire code, because it is almost 1500 lines long... In case it's helpful, here are my imports from the top of the code:

from kivy.app import App
from kivy.clock import Clock
from kivy.graphics import Color, Rectangle
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.widget import Widget
from random import randrange

Any help is greatly appreciated!

This is the new error message after installing Pillow:

C:UsersMeAppDataLocalProgramsPythonPython36-32python.exe C:/Users/Me/Desktop/PycharmProjects/music_game_kivy/music_game_kivy.py
[INFO   ] [Logger      ] Record log in C:UsersMe.kivylogskivy_17-12-26_11.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [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   ] [Audio       ] Providers:  (audio_ffpyplayer, audio_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:UsersMeAppDataLocalProgramsPythonPython36-32libsite-packageskivycore\__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "C:UsersMeAppDataLocalProgramsPythonPython36-32libsite-packageskivycorewindowwindow_sdl2.py", line 26, in <module>
    from kivy.core.window._window_sdl2 import _WindowSDL2Storage

[INFO   ] [Text        ] Provider: pil(['text_sdl2'] ignored)
[CRITICAL] [App         ] Unable to get a Window, abort.

Process finished with exit code 1
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For windows try following command from command prompt:

pip install Pillow or python -m pip install Pillow

Pillow is a fork of PIL, the Python Imaging Library, which is no longer maintained. However, to maintain backwards compatibility, the old module name is used.

For sdl2 try following(windows):

python -m pip install kivy.deps.sdl2
python -m pip install kivy.deps.glew

or try:

python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...