是否可以使用Python为iOS和Android编写跨平台应用程序?

时间:2022-05-17 02:27:13

Is it possible to use Python to write cross-platform apps for both iOS and Android

是否可以使用Python为iOS和Android编写跨平台应用程序

4 个解决方案

#1


26  

For Android Google provides something called ASE (Android Scripting Environment) which allows scripting languages (Python included) to run on Android. More details here

对于Android谷歌提供了ASE (Android脚本环境),它允许脚本语言(包括Python)在Android上运行。更多细节在这里

For iOS, it might be quite a bit more complicated (and I'd advise to check the latest version of iOS SDK agreement to check the current state of the law - apple tends to allow & disallow such apps periodically). For the technical part you might need to interface between Python & Objective C as well as do some wizardry to statically link all the libraries Python requires; full details are available here. Another approach for iOS Python development would be to embed a Python interpreter into you app and distribute your Python script with it (so to play nicely with Apple rules). In this case your Python application would be a Python interpreter which is packaged with your script and runs it automatically.

对于iOS,它可能要复杂得多(我建议查看最新版本的iOS SDK协议来检查当前的法律状态——苹果倾向于周期性地允许和禁止此类应用)。对于技术部分,您可能需要在Python和Objective C之间进行接口,还需要一些技巧来静态地链接Python所需的所有库;详情请点击这里。iOS Python开发的另一种方法是将Python解释器嵌入到您的应用程序中,并使用它分发您的Python脚本(以便与Apple规则很好地配合)。在这种情况下,您的Python应用程序将是一个Python解释器,它与您的脚本打包并自动运行。

Second option is to use Kivy framework(kivy.org) - it's a framework to write touch-friendly applications in Python and package them for different platforms. It's had Android support for a while, and recently added iOS support

第二种选择是使用Kivy framework(kivy.org)——它是一个用Python编写适合触摸的应用程序并为不同平台打包的框架。它有一段时间支持Android,最近还增加了iOS支持

#2


73  

An option is kivy: a cool cross platform Python framework which works for Android, Win7, Linux, MacOSX and iOS.

kivy是一个很酷的跨平台Python框架,适用于Android、Win7、Linux、MacOSX和iOS。

Update: kivy project is growing daily, now supports also Raspberry Pi

更新:kivy项目每天都在增长,现在还支持覆盆子派

#3


4  

For writing a GUI applicaion you can use the Toga library,then package it with briefcase into a Android and/or iOS app (or Windows, Linux, macOS etc).

要编写GUI应用程序,可以使用Toga库,然后将公文包打包到Android和/或iOS应用程序(或Windows、Linux、macOS等)中。

Note: the project is still in alpha state but under rapid development.

注:项目仍处于alpha状态,但发展迅速。

#4


1  

You can try and combine and . The Brython wiki describes how to write an Android app using Brython, which might provide the necessary information to do this also using Cordova. I haven't tested this yet, but it sounds promising. You should however be aware that due to its nature, Brython cannot support x86-compiled packages such as OpenCV (see e.g. here). On the other hand, if you know a bit about JavaScript / HTML5, you can use the WebView native functions, e.g. http://www.brython.info/gallery/three.html.

你可以尝试把布莱顿和科尔多瓦结合起来。Brython wiki描述了如何使用Brython编写一个Android应用程序,该应用程序可能提供了使用Cordova进行此操作的必要信息。我还没有测试过这个,但是听起来很有希望。但是,您应该知道,由于Brython的性质,它不支持诸如OpenCV之类的x86编译包(参见此处)。另一方面,如果您了解一些JavaScript / HTML5,您可以使用WebView本机函数,例如http://www.brython.info/gallery/three.html。

#1


26  

For Android Google provides something called ASE (Android Scripting Environment) which allows scripting languages (Python included) to run on Android. More details here

对于Android谷歌提供了ASE (Android脚本环境),它允许脚本语言(包括Python)在Android上运行。更多细节在这里

For iOS, it might be quite a bit more complicated (and I'd advise to check the latest version of iOS SDK agreement to check the current state of the law - apple tends to allow & disallow such apps periodically). For the technical part you might need to interface between Python & Objective C as well as do some wizardry to statically link all the libraries Python requires; full details are available here. Another approach for iOS Python development would be to embed a Python interpreter into you app and distribute your Python script with it (so to play nicely with Apple rules). In this case your Python application would be a Python interpreter which is packaged with your script and runs it automatically.

对于iOS,它可能要复杂得多(我建议查看最新版本的iOS SDK协议来检查当前的法律状态——苹果倾向于周期性地允许和禁止此类应用)。对于技术部分,您可能需要在Python和Objective C之间进行接口,还需要一些技巧来静态地链接Python所需的所有库;详情请点击这里。iOS Python开发的另一种方法是将Python解释器嵌入到您的应用程序中,并使用它分发您的Python脚本(以便与Apple规则很好地配合)。在这种情况下,您的Python应用程序将是一个Python解释器,它与您的脚本打包并自动运行。

Second option is to use Kivy framework(kivy.org) - it's a framework to write touch-friendly applications in Python and package them for different platforms. It's had Android support for a while, and recently added iOS support

第二种选择是使用Kivy framework(kivy.org)——它是一个用Python编写适合触摸的应用程序并为不同平台打包的框架。它有一段时间支持Android,最近还增加了iOS支持

#2


73  

An option is kivy: a cool cross platform Python framework which works for Android, Win7, Linux, MacOSX and iOS.

kivy是一个很酷的跨平台Python框架,适用于Android、Win7、Linux、MacOSX和iOS。

Update: kivy project is growing daily, now supports also Raspberry Pi

更新:kivy项目每天都在增长,现在还支持覆盆子派

#3


4  

For writing a GUI applicaion you can use the Toga library,then package it with briefcase into a Android and/or iOS app (or Windows, Linux, macOS etc).

要编写GUI应用程序,可以使用Toga库,然后将公文包打包到Android和/或iOS应用程序(或Windows、Linux、macOS等)中。

Note: the project is still in alpha state but under rapid development.

注:项目仍处于alpha状态,但发展迅速。

#4


1  

You can try and combine and . The Brython wiki describes how to write an Android app using Brython, which might provide the necessary information to do this also using Cordova. I haven't tested this yet, but it sounds promising. You should however be aware that due to its nature, Brython cannot support x86-compiled packages such as OpenCV (see e.g. here). On the other hand, if you know a bit about JavaScript / HTML5, you can use the WebView native functions, e.g. http://www.brython.info/gallery/three.html.

你可以尝试把布莱顿和科尔多瓦结合起来。Brython wiki描述了如何使用Brython编写一个Android应用程序,该应用程序可能提供了使用Cordova进行此操作的必要信息。我还没有测试过这个,但是听起来很有希望。但是,您应该知道,由于Brython的性质,它不支持诸如OpenCV之类的x86编译包(参见此处)。另一方面,如果您了解一些JavaScript / HTML5,您可以使用WebView本机函数,例如http://www.brython.info/gallery/three.html。