python logo

Android Development in Python with QPython

Python hosting: Host, run, and code Python in the cloud!

QPython is a script engine that lets you run Python scripts on Android. If you want to make Android apps, use Kivy instead.

Related courses:
If you want to make Android apps, I recommend one of these courses:
Building Android Apps in Python Using Kivy

QPython
The QPython app contains:


  • Python programming on Android

  • Run scripts / projects

  • IDE on Android

  • Pip (package manager)

  • SL4A for Android access (GPS, network, bluetooth and many more)


Please do note QPython is a scripting engine, similar to SL4A, and not an app development platform.

Installation


On the Google Playstore you can find both QPython (Python 2.7.2) and QPython3 (Python 3.2.2). We recommend going with Python 3.2.2 but you may want to use Python 2.7.2 for legacy reasons.

python for android Python on Android

Usage


Once installed you will find yourself in an iconic menu. The first icon will open the Python interpreter.

qpython-menu qpython-menu

IDE


The second icon (Editor) will start the Python IDE. It has syntax highlighting and some other features. While its useful to have an IDE on the Android device, typing on a mobile or tablet may not be your preference. All scripts are stored in /storage/emulated/0/com.hipipal.qpyplus/scripts. You can upload directly to this directory from your favorite editor on the desktop. (The run button is at the bottom.)

qpython-ide QPython IDE

Interpreter


You can use the Python interpreter directly on your Android device. This is similar to starting the Python interpreter on Windows or Linux. While useful at times, you probably prefer using the IDE.

python-interpreter Python Interpreter on Android





Leave a Reply:




srk kathey Sun, 28 Aug 2016

I do not find the above app in android Google play store..can you provide me the right link where I can download

Frank Sun, 28 Aug 2016

The authors moved it from Google play store but it's still an ongoing project.
You can get it from Github.

For Python 3: https://github.com/qpython-android/qpython3/releases
For Python 2.x: https://github.com/qpython-android/qpython/releases

Download adb, it's included in Android Studio
Open the command line and install QPython with adb:


adb install qpython3-release.apk

Alternatives:

1: Other Python interpreters
If you do not want to install adb and the app manually, there are other Python interpreters on the play store like:
pythoninterpreter

2: SL4A - Scripting Layer for Android
Run Python code like native Android, full access to almost any functionality including sending text message, calling, GPS and more.
https://pythonspot.com/en/sl4a-android-python-scripting/