【发布时间】:2016-11-10 16:03:12
【问题描述】:
我一直在谷歌搜索,发现有人展示了导入 sl4a 而不是 androidhelper 的脚本。当我尝试这样做时,我收到“没有名为 sl4a 的模块”。它仅在 Qpython3 中运行吗?我在 qpython 的站点包文件夹中有用于 arm 的 sl4a。谢了。
【问题讨论】:
我一直在谷歌搜索,发现有人展示了导入 sl4a 而不是 androidhelper 的脚本。当我尝试这样做时,我收到“没有名为 sl4a 的模块”。它仅在 Qpython3 中运行吗?我在 qpython 的站点包文件夹中有用于 arm 的 sl4a。谢了。
【问题讨论】:
在 qpython2 中,sl4a 模块被封装在 androidhelper 中。事实上,sl4a 模块会被导入到 androidhelper 中
您可以在 qpython2 中单独导入 sl4a
from androidhelper import sl4a
# OR
import androidhelper.sl4a as sl4a
# OR
import androidhelper # then access sl4a with androidhelper.sl4a
在 qpython3 中,sl4a 和 androidhelper 模块都在 sys.path 中,因此您可以导入其中任何一个
【讨论】: