Git Product home page Git Product logo

android-python27's Introduction

android-python27

Embed Python 2.7 (3.2 and others) interpreter and your scripts into an Android APK:

The objective of this project is to help people embed a Python for Android interpreter along with their scripts into a single APK that will not require the interpreter to be downloaded separately. A custom version of Python can also be used.

Wiki: http://code.google.com/p/android-python27/w/list

News:

4 April 2013 - Added template for Python 3: https://github.com/devpack/android-python27/tree/master/apk_python32


Overview: (Check the Wiki tutorials for more detailed instructions)

apk: This is the Python project template that will embed a Python interpreter and your Python scripts into an APK.

  • To use this template project in Eclipse, just go to File->Import and select the apk template folder. It's recommended that you then run Project->clean to generate R.java

  • Your Python scripts should be collected and zipped into an archive, and then placed inside the res/raw directory. An example zip archive containing a main Python script (hello.py) is already in the res/raw directory, which can be replaced with a zip archive with the same name, or a different name (see the second to last bullet point below in this section about naming).

  • The Python interpreter, including all binaries and modules, should be zipped into an archive and also placed inside the res/raw directory. The template already has a zip archive containing the Python interpreter in this directory, so you don't need to change this if your APK runs fine. You can add modules that are needed for your scripts or remove them just by editing the files in this zip archive, or you can use your own Python build by replacing this zip archive with one containing your Python build (see the last bullet point below in this section about naming).

  • If you change the name of the main Python script (hello.py) or the name of the zip archive containing your Python scripts, then in src/GlobalConstants.java change the values for: Python_MAIN_SCRIPT_NAME and PYTHON_PROJECT_ZIP_NAME respectively.

  • If you change the name of the zip archive containing the Python interpreter and the Python extras, then in src/GlobalConstants.java change the values for: PYTHON_NICE_NAME, PYTHON_ZIP_NAME, and PYTHON_EXTRAS_ZIP_NAME respectively.

python-build:

  • Currently the apk project template above contains Python version 2.7.2 already built and included inside the apk/res/raw directory, so there's no need to build Python yourself.

  • If you wish to build Python 2.7.2 however, you'll find the source code in python-build (see README). This will build Python and create the python_27.zip and python_extras_27.zip archives to replace the ones located inside the apk/res/raw directory.

python-build-with-qt:

  • If you wish to use Python 2.7.2 with PyQT, pre-built binaries are located inside python-build-with-qt/binaries, named python_27.zip and python_extras_27.zip. Just replace the archives of the same name inside apk/res/raw with these.

  • If you wish to build Python 2.7.2 with PyQT yourself, you'll find the source code in python-build-with-qt (see README_MOD). This will build Python with PyQT and create the python_27.zip and python_extras_27.zip archives to replace the ones with the same name inside apk/res/raw.


Based on:

android-python27's People

Contributors

devpack avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.