在 android 中编写 python(或任何其他 SL4A)

发布于 2024-09-25 11:21:16 字数 1536 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

还不是爱你 2024-10-02 11:21:16

注意:所有这些都是在运行 Android 2.2 的 Samsung Galaxy S 上进行测试的。 YMMV。

在我看到这个之前,我从来没有想过在 Android 上运行 Python。谢谢:)
我安装了 SL4A 应用程序并尝试了一个简单的 Shell 脚本。我正在安装 Python 解释器,并将很快尝试 hello world。

步骤很简单:
1. 下载应用程序(市场上没有该应用程序,因此请从 http://code 获取.google.com/p/android-scripting/)
2. 单击“添加”按钮并在弹出的选项中选择“Shell”来创建 shell 脚本
3. 编写代码。
4. 选择“保存并运行”(或“保存并退出”并单击主窗口中的脚本名称)
5. 此时,您的脚本的输出应该显示在终端窗口中。

现在我正在尝试安装 Python 解释器。将保持线程更新,但我想这将是同一组步骤。我在下载文件时遇到很多问题 - 下载速度很慢并且不断关闭。

我不知道你是否可以从 Android 应用程序调用这些脚本。该项目的意图似乎恰恰相反。但我知道什么!

编辑:继续我的 Python 经验。
1. 打开 SL4A 并进入“查看”->“解释器”菜单。如果 Python 未列出,则从菜单中选择“添加”。
2.这将下载您安装的apk(确保安装非市场应用程序可用)
3. 打开 Android 版 Python 应用程序。它有一个按钮“安装”
4. 单击“安装”并等待...然后等待...在此之前不要使用手机,安装似乎存在此应用程序中的错误,因此如果您在手机或标签上使用任何其他应用程序而不是此应用程序下载被取消!!!
5. 成功安装后返回 SL4A,您现在应该在解释器中看到 Python 以及许多示例 Python 脚本。
6. 示例似乎涵盖了相当多的 API。我所看到的给我留下了深刻的印象。

编辑:
自从最初的帖子发布以来,我还在运行 Android 4.0 的 Galaxy S2 上进行了测试。取得了同样令人印象深刻的结果。

Note: All this was tested on my Samsung Galaxy S running Android 2.2. YMMV.

I never thought of running Python on android till I saw this. Thanks :)
I installed the SL4A app and tried out a simple Shell script. I am installing the Python interpreter and will be trying out a hello world soon.

The step were straight forward:
1. Download the app (it.s not on the market so get it from http://code.google.com/p/android-scripting/)
2. Create a shell script by clicking the Add button and choosing Shell in the options that pop-up
3. Write your code.
4. Select "Save and Run" (or "Save and Exit" and click on the script name in the main window)
5. At this point your script's output should show up in the terminal window.

Now I am trying to install the Python interpreter. Will keep the thread updated but I guess this will be same set of steps. I am having a lot of issues downloading the files - the download is slow and keeps closing.

I don't know if you can call these scripts from an Android appln. The intention of the project seems to be the other way around. But what do I know!

Edit: Continuing with my experience with Python.
1. Open SL4A and go to View->Interpreters menu. If Python isn't listed then select Add from the menu.
2. This will download an apk which you install (make sure install non-market applications is available)
3. Open the Python for Android app. It has a single button "Install"
4. Click on the Install and wait... and wait... Don't use the phone till this the install is there seems to be bug in this app so if you use any other app on the phone or tab away from this one the download gets cancelled!!!
5. After a successful install return to SL4A you should now see Python in the Interpreters and a lot of sample Python scripts.
6. The samples seem to cover quite a bit of the APIs. I was quite impressed by what I saw.

Edit:
Since the original post I have also tested on a Galaxy S2 running Android 4.0. with similarly impressive results.

情释 2024-10-02 11:21:16

安装 Android Scripting (SL4A) .apk 后,您是否已安装 适用于 Android 的 Python

  1. 现在,每当您启动 SL4A 时,这肯定会起作用,您将点击更多选项
  2. ,您将看到“添加”按钮,只需单击即可创建脚本。
  3. 运行时它会要求运行环境选择终端。
  4. 终端运行。
  5. 首先测试 Python 是否在 Android 上运行 在 SL4A 上测试示例程序。

After installing Android Scripting (SL4A) .apk have you installed Python for Android?

  1. This would surely work now whenever you start SL4A you would tap for more options
  2. you will get to see Add button just click on that create your scripts.
  3. while running it would ask for running environment choose terminal for that.
  4. The Terminal runs.
  5. First for testing Python is running on you Android or not Test the Sample programs at the SL4A.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文