如何将 SQLAlchemy 与 buildozer 一起使用?
How to use SQLAlchemy with buildozer?
最近buildozer编译了一个简单的"hello world"程序。
但我想在 main.py 文件中使用 SQLAlchemy。
文件包含:
# -*- coding: utf-8 -*-
import kivy
kivy.require('1.10.0')
from kivy.app import App
from kivy.uix.button import Button
from sqlalchemy import create_engine
from kivy.uix.label import Label
class MyApp(App):
def build(self):
pass
def olustur(self):
engine = create_engine('sqlite:///database.db', echo = True)
cur = engine.connect()
self.root.ids['etkt'].text = 'Bağlantı Başarılı!'
if __name__ == '__main__':
MyApp().run()
还有一个 myapp.kv 文件,其中包含:
GridLayout:
cols: 2
Label:
id: etkt
text: 'Etiket'
Button:
text: 'Tıkla'
on_press: app.olustur()
我更改了 buildozer.spec 文件中的必要部分:
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax,SQLAlchemy,kivy
# change the major version of python used by the app
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.10.0
# (str) Android NDK version to use
#android.ndk = 9c
android.ndk = 10.3.2
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
#android.ndk_path =
android.ndk_path = /opt/crystax-ndk-10.3.2
但是报错
我想学习的是,我还应该像下面这样更改规范文件的一部分,或者我应该做不同的事情吗?
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
requirements.source.SQLAlchemy = .../../SQLAlchemy
提前致谢。
编辑:
新的输出是:
[INFO]: Will compile for the following archs: armeabi-v7a
[INFO]: Found Android API target in $ANDROIDAPI
[INFO]: Available Android APIs are (19)
[INFO]: Requested API target 19 is available, continuing.
[INFO]: Found NDK dir in $ANDROIDNDK
[INFO]: Got NDK version from $ANDROIDNDKVER
[WARNING]: NDK version was set as r10.3.2, but checking the NDK dir claims it is 10.3.2.
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.
[INFO]: Using Crystax NDK r10.3.2
[INFO]: Found virtualenv at /usr/bin/virtualenv
[INFO]: Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]: Picking the latest gcc toolchain, here 5
[INFO]: No existing dists meet the given requirements!
[INFO]: No dist exists that meets your requirements, so one will be built.
[ERROR]: Didn't find any valid dependency graphs.
[ERROR]: This means that some of your requirements pull in conflicting dependencies.
[ERROR]: Exiting.
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3crystax,sqlite3,sqlalchemy,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/tanberk/Android3/.buildozer/android/platform/build
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
配方名称是sqlalchemy
,不是SQLAlchemy
。
我会考虑添加一些关于案例的检查或警告,我以前没有想过这类问题。
最近buildozer编译了一个简单的"hello world"程序。
但我想在 main.py 文件中使用 SQLAlchemy。
文件包含:
# -*- coding: utf-8 -*-
import kivy
kivy.require('1.10.0')
from kivy.app import App
from kivy.uix.button import Button
from sqlalchemy import create_engine
from kivy.uix.label import Label
class MyApp(App):
def build(self):
pass
def olustur(self):
engine = create_engine('sqlite:///database.db', echo = True)
cur = engine.connect()
self.root.ids['etkt'].text = 'Bağlantı Başarılı!'
if __name__ == '__main__':
MyApp().run()
还有一个 myapp.kv 文件,其中包含:
GridLayout:
cols: 2
Label:
id: etkt
text: 'Etiket'
Button:
text: 'Tıkla'
on_press: app.olustur()
我更改了 buildozer.spec 文件中的必要部分:
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax,SQLAlchemy,kivy
# change the major version of python used by the app
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.10.0
# (str) Android NDK version to use
#android.ndk = 9c
android.ndk = 10.3.2
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
#android.ndk_path =
android.ndk_path = /opt/crystax-ndk-10.3.2
但是报错
我想学习的是,我还应该像下面这样更改规范文件的一部分,或者我应该做不同的事情吗?
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
requirements.source.SQLAlchemy = .../../SQLAlchemy
提前致谢。
编辑:
新的输出是:
[INFO]: Will compile for the following archs: armeabi-v7a
[INFO]: Found Android API target in $ANDROIDAPI
[INFO]: Available Android APIs are (19)
[INFO]: Requested API target 19 is available, continuing.
[INFO]: Found NDK dir in $ANDROIDNDK
[INFO]: Got NDK version from $ANDROIDNDKVER
[WARNING]: NDK version was set as r10.3.2, but checking the NDK dir claims it is 10.3.2.
[WARNING]: The build will try to continue, but it may fail and you should check that your setting is correct.
[WARNING]: If the NDK dir result is correct, you don't need to manually set the NDK ver.
[INFO]: Using Crystax NDK r10.3.2
[INFO]: Found virtualenv at /usr/bin/virtualenv
[INFO]: Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]: Picking the latest gcc toolchain, here 5
[INFO]: No existing dists meet the given requirements!
[INFO]: No dist exists that meets your requirements, so one will be built.
[ERROR]: Didn't find any valid dependency graphs.
[ERROR]: This means that some of your requirements pull in conflicting dependencies.
[ERROR]: Exiting.
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3crystax,sqlite3,sqlalchemy,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/tanberk/Android3/.buildozer/android/platform/build
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
配方名称是sqlalchemy
,不是SQLAlchemy
。
我会考虑添加一些关于案例的检查或警告,我以前没有想过这类问题。