6. 在Android上使用 Python Python 在 Android 上与桌面平台上不同。 在桌面平台上,皇冠通常是作为系统资源安装的,DG游戏该计算机的任何用户都可以使用。 然后,欧博注册用户通过运行 python 可执行文件并交互提示器中输入命令 ,欧博代理或运行脚本。 在安卓系统中,欧博官网没有将安装作为系统资源的概念。 软件分发的唯一单位是"应用程序"。 也没有可以运行 python 可执行文件或与 Python REPL 交互的控制台。 As a result, the only way you can use Python on Android is in embedded mode – that is, by writing a native Android application, embedding a Python interpreter using libpython, and invoking Python code using the Python embedding API. The full Python interpreter, the standard library, and all your Python code is then packaged into your app for its own private use. Python 标准库在 Android 上有一些明显的遗漏和限制。 详情参见 。 6.1. 添加Python到Android app只有当您打算自己编译 Python for Android 时,才需要使用这些指令。 大多数用户应该 不需要 这样做。 相反,使用以下工具之一会带来更轻松的体验: 如果您确定要手动完成所有这些操作,请继续阅读。您可以使用 testbed app 作为指南;下面的每个步骤都包含相关文件的链接。 在您的资源文件中: python*.* (Python 标准库) python*.*/site-packages (您自己的 Python 代码) 在应用程序中添加代码以 提取资源文件到文件系统。 在应用程序中添加代码 以嵌入模式启动 Python。 这需要通过 JNI 调用 C 代码。 (责任编辑:) |