简体   繁体   English

如何在 android 上运行 python 脚本?

[英]How can I run a python script on android?

I have an application in python and I want to run it on android.我在 python 中有一个应用程序,我想在 android 上运行它。 the applications has several libraries how can I do it?应用程序有几个库我该怎么做? thanks for your help感谢您的帮助

Download QPython from the play store ( https://play.google.com/store/apps/details?id=org.qpython.qpy&hl=en_US&referrer=utm_source%3Dgoogle%26utm_medium%3Dorganic%26utm_term%3Dqpython&pcampaignid=APPU_1_jDUOW4mtCMHdjwSz8aHQAQ ) and the python 3.6 updater for it ( https://play.google.com/store/apps/details?id=org.qpython.qpy36&hl=en_US&referrer=utm_source%3Dgoogle%26utm_medium%3Dorganic%26utm_term%3Dqpython&pcampaignid=APPU_1_9zUOW9yAFqr4jwSW-o24Bw ).从 Play 商店下载 QPython( https://play.google.com/store/apps/details?id=org.qpython.qpy&hl=en_US&referrer=utm_source%3Dgoogle%26utm_medium%3Dorganic%26utm_term%3Dqpython&pcampaignid=APPU_1_jDUOW4Qmt )和它的 3.6 更新程序( https://play.google.com/store/apps/details?id=org.qpython.qpy36&hl=en_US&referrer=utm_source%3Dgoogle%26utm_medium%3Dorganic%26utm_term%3Dqpython&pcampaignid=APPU_1_9_9zor4bw4jbw4jww4j Then do the following steps:然后执行以下步骤:

  1. Open QPython打开 QPython

  2. Close QPython immediately after you open it打开 QPython 后立即关闭它

  3. Open QPython 3.6 updater打开 QPython 3.6 更新程序

  4. Click "release python 3 resources"点击“释放python 3资源”

  5. After it is done installing python 3 go back into QPython安装完python 3后,回到QPython

  6. Click on the "more" button, this brings you to the settings menu单击“更多”按钮,这将带您进入设置菜单

  7. In the settings switch to python 3 by checking "switch to python 3" (the default is python 2), and you can optionally allow root access if you have rooted the device by checking "root mode"在设置中,通过选中“切换到 python 3”(默认为 python 2)切换到 python 3,如果您已经通过选中“root 模式”对设备进行了 root 访问,则可以选择允许 root 访问

After setting things up you can use pip to install packages if you want by going to the main menu and clicking on "QPyPi" then clicking on the big "install with pythons pypi" button at the top of the menu.设置完成后,如果需要,您可以使用 pip 安装软件包,方法是转到主菜单并单击“QPyPi”,然后单击菜单顶部的“使用 pythons pypi 安装”大按钮。

Some things to note is that some packages wont work or won't work properly (some users have complained about inability to use OpenCV for example).需要注意的一些事情是某些软件包无法正常工作或无法正常工作(例如,一些用户抱怨无法使用 OpenCV)。 Also I haven't been able to find a way to launch scripts from console and I haven't figured out how to get subprocess.Popen or os.sysyem to work right yet so using things like sys.argv is super annoying, you will probably need to find alternative means to get user argument input if your script needs it此外,我还没有找到从控制台启动脚本的方法,我还没有弄清楚如何让 subprocess.Popen 或 os.sysyem 正常工作,所以使用 sys.argv 之类的东西非常烦人,你会的如果您的脚本需要,可能需要找到替代方法来获取用户参数输入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM