8

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?

3
  • Are the non-standard libs open source? Commented Sep 18, 2013 at 18:21
  • @marcelosalloum I am trying to use github.com/yann2192/pyelliptic library, but proper documentation is not mentioned in kivy.Could you please tell me steps for the same? Commented May 26, 2015 at 16:41
  • @SandeepAggarwal, I've never managed to make it work. It was pretty immature at the time, I couldn't make it work and never tried again. Good luck! Commented May 26, 2015 at 20:01

2 Answers 2

6

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)

Sign up to request clarification or add additional context in comments.

5 Comments

If I use a solution with Python 2.7 for iOS I'd need the user to have it installed, right? Therefore I woudn't relie on this option. Have u ever used Kivy? Does it really do the work?
Ive used it with android and it runs like a native app ... I havent had experience in IOS with it but I assume its the same ... its kind of difficult to set up but once you get your environment setup it just works
I coudn't compile the distribution version and got the following error: stackoverflow.com/questions/18905622/…. When(if) I solve it I will post it her too
kivy-ios is now using clang compiler instead ov llvm-gcc and all appears to work now, thanks to Mathieu Virbel
Mattieu is a great guy
1

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.

2 Comments

I'm quite certain he isn't looking to just run some Python code in a shell but rather include it in another app.
we build android apps in python with kivy where I work and it works fine ... I suspect you are right about the ios script thing ... but kivy basically does what he wants (with some limitations)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.