python - Buildozer:NameError:未定义名称'functools'
问题描述
我正在尝试使用 Buildozer 构建应用程序。在我正在导入的主代码functools
中。该代码在计算机上运行正常,但是当我尝试在 android 上运行它时,我得到了NameError: name 'functools' is not defined
我试图将它添加到buildozer.spec
需求中,但这会产生不同的错误:
File "/tmp/pip-install-ef316qvg/functools/functools.py", line 34
raise TypeError, 'compose expects at least one argument'
^
SyntaxError: invalid syntax
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
在日志中,我可以看到 buildozer 正在尝试安装,functools
但据我所知,它已经安装/usr/lib64/python3.7/functools.py
并且可以导入。
谁能给我一个想法是怎么回事?
编辑:我看了一下 functools verzion:
>>> from getversion import get_module_version
>>> import functools
>>> version, details = get_module_version(functools)
>>> print(version)
3.7.7.final.0
>>> print(details)
Version '3.7.7.final.0' found for module 'functools' by strategy 'get_builtin_module_version', after the following failed attempts:
- Attempts for module 'functools':
- <get_module_version_attr>: module 'functools' has no attribute '__version__'
- <get_version_using_pkgresources>: Invalid version number: None
- <get_builtin_module_version>: SUCCESS: 3.7.7.final.0
解决方案
我认为您拥有的 python 版本与您编写的代码不匹配。您编写的代码适用于其他版本,但不适用于您正在使用的版本。
推荐阅读
- java - 无法解析符号'HttpResponse',但仍然运行正常,怎么可能?
- c# - 实体框架。添加新记录并仅通过一次查询返回总记录
- xamarin - 如何以编程方式将选择器设置为复选框
- komodo - Komodo:更改默认文件首选项
- kubernetes - 如何为 Web 应用程序构建 Kubernetes 项目?
- multithreading - 两个线程在scala中访问同一个文件
- opencv - 在树莓派上安装 opencv 后删除附加文件
- ruby-on-rails - 如何在显示页面上呈现不同的表单
- javascript - 如何将 WooCommerce 网站连接到 react-native?
- excel - VBA 将表格从工作表 1 复制并粘贴到工作表 2