提问人:Ben Wrench 提问时间:11/7/2023 更新时间:11/7/2023 访问量:26
使用 Buildozer 编译 Kivy 应用程序的问题:SDL2_ttf 中的 Python 2 打印语法
Issue with Compiling Kivy App Using Buildozer: Python 2 Print Syntax in SDL2_ttf
问:
我一直在为 android 构建一个 Kivy 应用程序。我一直在学习教程,但遇到很多错误。我能够解决其中的大多数问题,但我不知道如何解决这个问题
我在尝试使用 Buildozer 编译应用程序时遇到错误。它似乎与 SDL2_ttf 模块中的 Python 2 打印语法有关。错误消息提示缺少括号问题:
...
Compiling '/home/getwe/Amelia/Ops_AMELIA/.buildozer/android/app/venv/bin/rst2man.py'...
Compiling '/home/getwe/Amelia/Ops_AMELIA/.buildozer/android/app/venv/bin/rst2html.py'...
Compiling '/home/getwe/Amelia/Ops_AMELIA/.buildozer/android/app/kivy-deps-build/kivy-dependencies/build/SDL2-2.26.4/src/joystick/sort_controllers.py'...
Compiling '/home/getwe/Amelia/Ops_AMELIA/.buildozer/android/app/kivy-deps-build/kivy-dependencies/build/SDL2_ttf-2.20.2/external/freetype/src/tools/chktrcmp.py'...
*** File "/home/getwe/Amelia/Ops_AMELIA/.buildozer/android/app/kivy-deps-build/kivy-dependencies/build/SDL2_ttf-2.20.2/external/freetype/src/tools/chktrcmp.py", line 27
print "Usage: %s [option]" % sys.argv[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
...
我已经手动更正了 chktrcmp.py 中的打印语句,但似乎 Buildozer 正在重新安装模块并在每次构建时恢复更改。
我包含了我的 buildozer.spec 文件的前半部分以供参考,另一半都是默认的。
[app]
# (str) Title of your application
title = AMELIA
# (str) Package name
package.name = AMELIA
# (str) Package domain (needed for android/ios packaging)
package.domain = org.test
# (str) Source code where the main.py live
source.dir = .
# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,db,ini
# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png
# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec
# (list) List of directory to exclude (let empty to not exclude anything)
#source.exclude_dirs = tests, bin, venv
# (list) List of exclusions using pattern matching
# Do not prefix with './'
#source.exclude_patterns = license,images/*/*.jpg
# (str) Application versioning (method 1)
version = 0.1
# (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"]
# version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy,kivymd==1.1.1,bcrypt,mysql-connector-python,pillow,cffi==1.14.6,libffi,sdl2_ttf,sdl2_image,sdl2_mixer
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png
# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png
# (list) Supported orientations
# Valid options are: landscape, portrait, portrait-reverse or landscape-reverse
orientation = portrait
# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
我还确保SDL2_ttf和其他必需模块包含在我的要求中。有人可以帮我了解如何解决这个问题吗?任何指导或建议将不胜感激。
谢谢!
答: 暂无答案
评论