Kivy crashes on launch when importing external libraries(导入外部库时 Kivy 在启动时崩溃)
问题描述
我使用 Kivy Launcher 运行了一个基本的Hello World".程序,它运行良好,但是当我在开始时添加 import cv2 时,应用程序在启动后立即崩溃.
I used the Kivy Launcher to run a basic "Hello World" program and it worked fine, but when I added in an import cv2 at the beginning, the app crashes immediately after launching.
主.py:Main.py 代码
Android.txt:Android.txt 图片
Android.txt: Image of Android.txt
谢谢!
推荐答案
kivy启动器用于严格运行Kivy模块和Python预装模块.所以在这种情况下,由于 cv2 没有预装在正常的 python 安装中,kivy 启动器无法识别它,然后得到一个ModuleNotFoundError: No Module named cv2"错误,这会导致它崩溃.因此,如果您尝试导入预装 python 的模块以外的模块,则必须使用 Buildozer 编译成 .apk 文件才能在 android 上运行它
The kivy launcher is used to run strictly Kivy modules and Python preinstalled modules. So in this case, since cv2 doesn't come preinstalled in normal python installations, kivy launcher doesn't recognise it and then gets a "ModuleNotFoundError: No Module named cv2" error, which causes it to crash. So, if you're trying to import modules aside from those which come preinstalled with python you'd have to compile into a .apk file using Buildozer to run it on an android
这篇关于导入外部库时 Kivy 在启动时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:导入外部库时 Kivy 在启动时崩溃


基础教程推荐
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01