A Python3 script to build Python for Android
A simple Python3 script to build Python static libraries for Android.
Of cause, by applying some changes easily, it would also work for shared libraries.
Tested on macOS 10.15 with NDK-r21 for Python 2.7.x.
If you dont work on macOS, you might have to change
BUILD
andNDK_TOOLCHAIN
defined at front.
> python3 py4android.py [-h] [--api API] --version VERSION ARCH [ARCH ...]
Build Python for Android.
positional arguments:
ARCH currently supports: armeabi-v7a armv8a x86 x86_64
optional arguments:
-h, --help show this help message and exit
--api API specify Android API level (default 21)
--version VERSION specify Python version string (directory Python-<VERSION> must exists at this working path)
py4android.py
along with Python source codePython-<VERSION>.tgz
to Python-<VERSION>
(within the same directory)python3 py4android.py --api 21 --version 2.7.14 armeabi-v7a armv8a x86 x86_64
assuming you have define
ANDROID_NDK_ROOT
in your environ
prebuilt/android/<VERSION>/include
, and the (static) libraries could be found at prebuilt/android/<VERSION>/libs/<ARCH>/libpython.a