[英]kivymd app crashes on android phone ModuleNotFoundError: No module named 'PIL'
My Kivy app crashes on launch on android phone.我的 Kivy 应用程序在 android 手机上启动时崩溃。 buildozer logcat shows the following error:
buildozer logcat 显示以下错误:
02-21 17:09:58.777 14941 14979 I python : ModuleNotFoundError: No module named 'PIL'
02-21 17:09:58.777 14941 14979 I python : Python for android ended.
Here are my buildozer.spec requirements:这是我的 buildozer.spec 要求:
requirements = python3,kivy==2.0.0,git+https://github.com/HeaTTheatR/KivyMD.git,sdl2_ttf==2.0.15,python-dateutil,requests,urllib3,chardet,idna,plyer,android,jnius,oscpy
As I understand, only the KivyMD depends on PIL.据我了解,只有 KivyMD 依赖于 PIL。 The app works perfectly on my mac and WAS working before on the android phone.
该应用程序在我的 Mac 上完美运行,并且之前在 android 手机上运行。 The error just started to occur.
错误刚刚开始发生。 So, I'm really confused and would appreciate any help.
所以,我真的很困惑,希望能得到任何帮助。 Thanks in advance!
提前致谢!
As you might already know, KivyMD depends on PIL, not Kivy.您可能已经知道,KivyMD 依赖于 PIL,而不是 Kivy。 You are using the latest version of KivyMD using git in your app, which depends on
PIL
.您正在使用最新版本的 KivyMD,在您的应用程序中使用 git,这取决于
PIL
。 To remove the error just add pillow
in the requirements
of your buildozer.spec
file.要消除错误,只需在
buildozer.spec
文件的requirements
中添加pillow
。
If you are still not getting the desired result after following the correct answer, do refer to the requirements specidied in buildozer.spec file for the KivyMD-kitchen_sink app in the repo.如果您在遵循正确答案后仍然没有得到所需的结果,请参阅 buildozer.spec 文件中为 repo 中的 KivyMD-kitchen_sink 应用程序指定的要求。
This is the link -> Kitchen_Sink_Repo这是链接-> Kitchen_Sink_Repo
Tip小费
If, after changing the requirements
you still see your app crashing, run the following command(s)如果在更改
requirements
后您仍然看到您的应用程序崩溃,请运行以下命令
buildozer android clean
buildozer android debug deploy run
Why?为什么?
Because when buildozer installs the earlier specified requirements, it is quiet possible that it installs versions that are not matching your apps specifications.因为当 buildozer 安装早期指定的要求时,它很可能会安装与您的应用程序规格不匹配的版本。 So clean it and then run.
所以清理它然后运行。
You should now be good to go.您现在应该对 go 很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.