问题
I have some AI code developed in python 2.7 that uses non-standard libraries.
I intend to compile it to work with my iPhone app.
I wouldn't like to re-program everything so, is that a way to compile my python code + all dependencies into a static file so I can call it from my iOS app as a function?
回答1:
kivy can do it
http://kivy.org/docs/guide/packaging-ios.html
also maybe look at https://itunes.apple.com/us/app/python-for-ios/id485729872?ls=1&mt=8
although I doubt you can just compile your existing project into it... you will need to re-write at least part of it and you can only use pure python libraries (kivy)
回答2:
iPhone apps must be Objective-C, C, C++ or Objective-C++. They cannot interpret Python code.
However, if you have access to the library source, you may be able to translate and then compile the Python source to C code.
I would look into the PyPy Toolchain as a starting point.
来源:https://stackoverflow.com/questions/18879490/is-that-possible-to-run-a-python-built-program-on-ios-as-a-static-lib