gpt4 book ai didi

python - 无法使用 buildozer 构建 apk

转载 作者:行者123 更新时间:2023-12-04 18:49:35 32 4
gpt4 key购买 nike

我已经尝试构建 APK 3 天了。总的来说,我对 Linux 很陌生,我已经按照本教程进行操作:https://www.youtube.com/watch?v=kcte8vcGMSU
我按照他的说明做所有事情,唯一的区别是我无法像他那样安装 kivy,我以另一种方式安装了它,但它可以工作,我可以从终端运行我的 main.py。
无论如何,buildozer init 可以工作,但是当我尝试使用 buildozer android debug 时,会弹出这个错误:

Traceback (most recent call last):
File "/home/rain/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 567, in _build_master
ws.require(__requires__)
File "/home/rain/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 884, in require
needed = self.resolve(parse_requirements(requirements))
File "/home/rain/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 775, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (buildozer 0.38.dev0 (/home/rain/.local/lib/python3.8/site-packages), Requirement.parse('buildozer==1.2.0.dev0'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/buildozer", line 33, in <module>
sys.exit(load_entry_point('buildozer==1.2.0.dev0', 'console_scripts', 'buildozer')())
File "/home/rain/.local/lib/python3.8/site-packages/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/home/rain/.local/lib/python3.8/site-packages/buildozer/__init__.py", line 1053, in run_command
targets = [x[0] for x in self.targets()]
File "/home/rain/.local/lib/python3.8/site-packages/buildozer/__init__.py", line 1053, in <listcomp>
targets = [x[0] for x in self.targets()]
File "/home/rain/.local/lib/python3.8/site-packages/buildozer/__init__.py", line 944, in targets
m = __import__('buildozer.targets.{0}'.format(target),
File "/home/rain/.local/lib/python3.8/site-packages/buildozer/targets/android.py", line 41, in <module>
from distutils.version import LooseVersion
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
File "<frozen importlib._bootstrap>", line 556, in module_from_spec
File "/home/rain/.local/lib/python3.8/site-packages/_distutils_hack/__init__.py", line 83, in create_module
return importlib.import_module('setuptools._distutils')
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/rain/.local/lib/python3.8/site-packages/setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "/home/rain/.local/lib/python3.8/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/home/rain/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3239, in <module>
def _initialize_master_working_set():
File "/home/rain/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3222, in _call_aside
f(*args, **kwargs)
File "/home/rain/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3251, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/home/rain/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 569, in _build_master
return cls._build_from_requirements(__requires__)
File "/home/rain/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 582, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/home/rain/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 770, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'buildozer==1.2.0.dev0' distribution was not found and is required by the application
对不起,我是新手,我真的很困惑和无助。任何帮助将不胜感激。在 VM 中使用最新版本的 Ubuntu。

最佳答案

这可能是因为您使用的是 python 3.8
尝试 python 3.6 并确保不仅安装 python3.6 还将主要 python 版本更改为 3.6
如何安装python很容易找到所以我不会讨论

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 0
sudo update-alternatives --install /usr/bin/python python3 /usr/bin/python3.6 0
最后一个数字 0 是优先级,如果上面不起作用,请尝试 1 或 2
这是更改主要 python 版本的方法

关于python - 无法使用 buildozer 构建 apk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63720943/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com