Kivy Buildozer VM sh.ErrorReturnCode_127 错误

Posted

技术标签:

【中文标题】Kivy Buildozer VM sh.ErrorReturnCode_127 错误【英文标题】:Kivy Buildozer VM sh.ErrorReturnCode_127 error 【发布时间】:2019-07-03 07:16:18 【问题描述】:

我正在尝试在 Kivy 虚拟机上使用 Buildozer 为 APK 构建一个简单的 Python 程序。每次我运行buildozer android debug,我都会收到以下错误

pid 2134:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 1540, in wrap
    fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 2459, in    background_thread
    handle_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 2157, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 815, in     handle_command_exit_code
raise exc
ErrorReturnCode_127: 

  RAN: /home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform        /build/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/autogen.sh

  STDOUT:
/home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform/build    /build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/autogen.sh: 2:     exec: autoreconf: not found


  STDERR:


Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform    /python-for-android/pythonforandroid/toolchain.py", line 1073, in <module>
    main()
  File "/home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1067, in main
    ToolchainCL()
  File "/home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 576, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 151, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 200, in     build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "pythonforandroid/build.py", line 562, in build_recipes
  File "/home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/libffi/__init__.py", line 33, in     build_arch
    shprint(sh.Command('./autogen.sh'), _env=env)
  File "pythonforandroid/logger.py", line 178, in shprint
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 863, in next
    self.wait()
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 815, in     handle_command_exit_code
    raise exc
sh.ErrorReturnCode_127: 

  RAN: /home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform/build/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/autogen.sh

  STDOUT:
/home/kivy/Desktop/Projects/Kivy_Test/.buildozer/android/platform/build    /build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/autogen.sh: 2:     exec: autoreconf: not found


  STDERR:

# Command failed: /usr/bin/python -m pythonforandroid.toolchain create         --dist_name=kivytest --bootstrap=sdl2 --requirements=python3,kivy --arch         armeabi-v7a --copy-libs --color=always --storage-dir="/home/kivy/Desktop    /Projects/Kivy_Test/.buildozer/android/platform/build" --ndk-api=21
# 
# 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

注意:我的buildozer.spec 中的log_level 是2。我尝试安装一些依赖项,但Kivy VM 不让我出于任何原因。如果有人可以帮助我,那就太好了!

【问题讨论】:

【参考方案1】:

我遇到了同样的问题,在我的情况下,我缺少文件中描述的 python-for-android 所需的以下系统依赖项:python-for-android file

我缺少的依赖项:

自动制作 自动配置 libltdl-dev

我在 Buildozer 的 Github 论坛中找到了该解决方案: Github Question

因此,您可能还缺少一些依赖项。 对我来说,运行以下命令效果很好:

sudo apt-get install automake
sudo apt-get install autoconf
sudo apt-get install libltdl-dev

【讨论】:

【参考方案2】:

我正在使用 Python 3.7 运行 macOS 10.14。我在 buildozer 中遇到了类似的问题,并在 buildozer/kivy github、google groups 等中搜索了答案。所有答案都以 buildozer 在 Linux 上的工作开始。对于 macOS apt-get 不直接支持——Fink 是第 3 方端口。但是,在 macOS 上很好地支持 Homebrew。为了解决 buildozer 问题,我使用 brew 来安装所需的软件包。具体

$ brew install automake
$ brew install autoconfig
$ brew install libtool

“buildozer -v android debug”结果成功

【讨论】:

以上是关于Kivy Buildozer VM sh.ErrorReturnCode_127 错误的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 buildozer 和最新的 kivy 构建 kivy 应用程序?

python, kivy, geopy, buildozer

Buildozer 错误,CalledProcessError (Kivy)

《Buildozer打包实战指南》第二节 安装Kivy和Buildozer

《Buildozer打包实战指南》第二节 安装Kivy和Buildozer

Python、Kivy、Buildozer:使用 python-firebase/requests 时出错