如何在 Kivy Launcher 中运行 OpenCV?

How to run OpenCV in Kivy Launcher?(如何在 Kivy Launcher 中运行 OpenCV?)

本文介绍了如何在 Kivy Launcher 中运行 OpenCV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个需要 OpenCV 模块的 Kivy 应用程序,但是 Kivy 启动器在我运行它时不断崩溃.

I am building a Kivy app that requires the OpenCV module, but the Kivy Launcher keeps crashing when I run it.

我已经从 PyPi (https://pypi.python.org/pypi/opencv-python#downloads) 并将其放入我的 kivy 项目目录中.我的项目目录目前包含main.py文件、android.txt文件和opencv下载.在 main.py 文件中,我在代码顶部写了import cv2".但是,我的应用程序在 Kivy 启动器中不断崩溃.

I have downloaded OpenCV from PyPi (https://pypi.python.org/pypi/opencv-python#downloads) and placed it into my kivy project directory. My project directory currently contains the main.py file, the android.txt file, and the opencv download. In the main.py file I write "import cv2" at the top of the code. However, my app keeps crashing in the Kivy launcher.

在 Kivy Launcher 中安装 python 扩展的正确方法是什么?

What is the correct way to install python extensions for use in Kivy Launcher?

顺便说一句-我是 Kivy 和 Android 应用程序开发的新手,非常感谢任何帮助

BTW- I am brand new to Kivy and Android app development, so any help is much appreciated

推荐答案

我已经从 PyPi 下载了 OpenCV(https://pypi.python.org/pypi/opencv-python#downloads) 并放置它进入我的 kivy 项目目录

I have downloaded OpenCV from PyPi (https://pypi.python.org/pypi/opencv-python#downloads) and placed it into my kivy project directory

事情不是这样运作的.OpenCV 应该专门为 Android 编译.我猜你使用 buildozer 来构建 apk?在这种情况下,您应该修改 buildozer.spec 文件中的 requirements 行以添加 opencv,例如:

This is not how things work. OpenCV should be compiled specifically for Android. I guess you use buildozer to build apk? In this case you should modify requirements line inside buildozer.spec file to add opencv, for example:

requirements =  kivy, opencv

为Android编译python模块提供python-for-android 项目.

Compiling python modules for Android provided by python-for-android project.

这篇关于如何在 Kivy Launcher 中运行 OpenCV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何在 Kivy Launcher 中运行 OpenCV?

基础教程推荐