1
最近buildozer編譯了一個簡單的「hello world」程序。如何將SQLAlchemy與buildozer一起使用?
但我想在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文件,其中包含:
# (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
:
GridLayout:
cols: 2
Label:
id: etkt
text: 'Etiket'
Button:
text: 'Tıkla'
on_press: app.olustur()
我buildozer.spec文件改變了necessarry零件
但它給出了一個錯誤。
我想學的是,我應該改變下面的規格文件的一部分,或者我應該做一個不同的事情?
# (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
我想你是對的。順便說一下最近一個android apk由Python 2.7創建。在.spec文件中,需求被寫入requirements = sqlite3,sqlalchemy,kivy。我會再次嘗試使用Python3。 –
我用Python2和Python3創建了一個簡單的「hello world」程序。但是這個sqlalchemy例子還沒有被Python3編譯。我添加了第一個例子的要求。 ndk版本相同,kivy版本相同。但它給出了一個錯誤。奇怪。也許我做了一些我還沒找到的錯誤。 –
sqlalchemy配方可能尚未經過python3測試。這就是說,你是否遵循[說明](http://python-for-android.readthedocs.io/en/latest/buildoptions/#python3),特別是使用CrystaX NDK? – inclement