python - 使用 python-for-android 将 kivy 应用程序编译为 apk 失败
问题描述
我用python和kivy编写了一个hello world测试应用程序,并尝试将其打包成apk,但它一直向我显示此错误,我不明白发生了什么。
这是我的代码:
import kivy
kivy.require('1.11.1')
from kivy.app import App
from kivy.uix.button import Button
class MyApp(App):
def build(self):
return Button(text = 'Hello World')
if __name__ in ('__android__', '__main__'):
MyApp().run()
我尝试使用以下命令编译为 apk:
p4a apk --private ./ --package=org.example.easample --name "easample" --version 0.1 --bootstrap=sdl2 --requirements=python3,kivy,pygame
它给出了这个错误信息:
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Exception information:
Traceback (most recent call last):
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
status = self.run(options, args)
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 382, in run
resolver.resolve(requirement_set)
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve
self._resolve_one(requirement_set, req)
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 313, in _get_abstract_dist_for
req, self.session, self.finder, self.require_hashes
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 224, in prepare_linked_requirement
req, self.req_tracker, finder, self.build_isolation,
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 49, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/distributions/source/legacy.py", line 39, in prepare_distribution_metadata
self.req.prepare_metadata()
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 563, in prepare_metadata
self.metadata_directory = metadata_generator(self)
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/operations/generate_metadata.py", line 124, in _generate_metadata_legacy
command_desc='python setup.py egg_info',
File "/home/ea/.local/share/python-for-android/build/venv/lib/python3.6/site-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
STDERR:
请问我需要帮助
解决方案
推荐阅读
- python - 如何在 python 中使用 matplotlib 制作正确的 covid 跟踪时间序列图?
- python - JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError:
- python - 如何限制 python 输入到某些 USB 设备
- react-native - 在 react-native 中测试文本对比度
- html - Set text layout in table html column
- php - 无法使用 PHP 从本地存储中删除文件
- xlwings - 安装了 xlwings v0.20.4 而不是 v0.20.5
- c++ - C++ 更改文本颜色
- asp.net-core - IIS 重写和 Windows 身份验证
- foreach - 解析和概括用于重命名变量的 Stata 程序