Termux is a fairly popular terminal emulator, but for your question specifically there are two alternatives; PyDroid 3 and QPython. The former is more polished, but the latter has built-in support for SL4A if you want to make use of device-specific features like cameras. Both can be used to both write and execute Python scripts. Answer from Diapolo10 on reddit.com
🌐
Reddit
reddit.com › r/learnpython › is it possible to run python scripts from my android phone?
r/learnpython on Reddit: Is it possible to run python scripts from my Android phone?
February 12, 2022 -

I am wondering if it is possible to run a python script from a mobile phone. Is there an app that simulates something like a bash terminal window? And since my phone is almost always up and running, would it be possible to use it as a remote server (think DigitalOcean's droplet) with scheduled jobs (cron)? Ideally, I could create (edit, test) my scripts on my Linux machine and then run them from my mobile.

🌐
Opensource.com
opensource.com › article › 20 › 8 › python-android-mobile
Create and run Python apps on your Android phone | Opensource.com
August 26, 2020 - I use the Flask framework to create ... No laptop or desktop required. First, install the Termux application. Termux is a powerful terminal emulator that ......
Discussions

Setting up Python so that it can be run on any Android terminal apps - Android Enthusiasts Stack Exchange
I'm trying to get Python 3 to run natively on Android. By "native", I mean native Linux, just an Android variation of it. I'd like to be able to simply open a terminal and type python /pa... More on android.stackexchange.com
🌐 android.stackexchange.com
December 8, 2018
Executing python script in android terminal emulator - Stack Overflow
I installed python 2.7 in my Android device and I tried executing a python script by typing the command in terminal emulator. The problem is that although I use the full path for python the following More on stackoverflow.com
🌐 stackoverflow.com
terminal - How to run Python 2 and Python 3 CLI programs on Android 14 phones? - Android Enthusiasts Stack Exchange
It looks like all the methods which used to work for running Python 2 and Python 3 CLI programs on Android phones is now outdated: SL4A QPython Termux + python packages I can't believe we can't run More on android.stackexchange.com
🌐 android.stackexchange.com
April 8, 2024
How can I run a Python script in terminal emulator? - Android Enthusiasts Stack Exchange
I tried running a Python script in a terminal emulator (app) with ./script.py and I get an error saying "permission denied". It is to run a Twitter bot even if I close the app. So, I goog... More on android.stackexchange.com
🌐 android.stackexchange.com
September 2, 2018
Top answer
1 of 1
1

I believe the solution for you is Python-for-Android (Py4A). Not only does it allow you to run scripts on your Android device, but you can go one step further because the project includes simple draft instructions on creating a standalone, downloadable Android APK package.

First, I would start by going to the readme section of Py4A. There is a recipes (script) that will fit your needs. The python3 recipe allows Python3 to run as a "standalone" on Android.

This excerpt from Linux Journal explains script installation on your Android device:

Running on a Smartphone

To run a Python script on your physical Android device, install SL4A together with Python for Android on your handset, then transfer your script.

To install SL4A on your physical Android device, enable the Unknown Sources option in your device's Application settings. This setting is required to enable the installation of non-Market apps on your phone. With this done, you can follow the same steps you used when installing SL4A and Python on your emulator. To speed things up a little, install Barcode Scanner from the Android Market and use it to “read” the QR Codes from your desktop screen.

Transferring Your Script to Your Handset

There are a number of ways to get your script onto a real phone. I've found the success of using something like Bluetooth connectivity or USB cabling arrangements can very much depend on the hardware on which you're running. What works on one handset, doesn't on another, and so on. Your mileage may vary depending on your actual device. When I need to transfer a file, I've come to rely on a solution that works no matter which handset I use (as long as the handset can talk to a local Wi-Fi network). What I do is switch on the OpenSSH server on my development PC running Linux, then use the AndFTP file transfer app on the handset to scp files from the desktop to the phone. AndFTP is available from the Android Market as a free download and installs in minutes. Once I connect to my desktop with AndFTP, I can navigate to a directory of my choice, mark the files that I want, then download them to my SD card on the handset.

AndFTP works well, and I've come to depend on it for all my Android file transfers (see Resources). Just be sure to transfer your scripts to /sdcard/sl4a/scripts on the phone to ensure that your script names appear within the SL4A list of scripts.

With your script file transferred to your physical device, start SL4A as before, tap your app's name and tap the run wheel. As expected, your app runs just as it did on the emulator, only faster! I haven't included a screenshot of the app running on a real phone for two reasons. First, it looks exactly the same as it did in the emulator, and second, it's running on your device, so you can take a look at it there!

Creating an APK

There's one further kink to SL4A that might interest you. The project includes draft instructions on creating a standalone, downloadable Android APK package (see Resources). Once created, the APK file bundles your custom Python script with information that allows other Android users to install Python for Android automatically onto their handsets and then run your app from the smartphone's main menu of apps. Describing the process of creating the APK likely would take another article, so I leave it to the brave among you to try out the instructions on the SL4A Wiki"

Python-for-Android website.

🌐
Sololearn
sololearn.com › en › Discuss › 1246761 › how-to-run-python3-on-android-like-you-run-on-an-terminal
How to run python3 on android like you run on an terminal? | Sololearn: Learn to code for FREE!
Actually, I already have a solution for this. My solution : installing Qpython on android then installing an terminal emulator and calling intialization script of Qpyt
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › python console mobile app?
r/learnpython on Reddit: Python console mobile app?
July 5, 2021 -

Hi,

Is there a mobile app that allows you to code python and display the output in a console?

I'm on the road for 2 months and am working from a textbook and can't necessarily always use my laptop to plug in practice exercises.

If not an app, potentially a website like CodePen that anyone can recommend? However, an app would be preferential.

Cheers.

Edit: should have mentioned I'm using an android device.

🌐
Hackaday
hackaday.com › 2019 › 12 › 28 › a-pocket-sized-terminal-for-mobile-python-hacking
A Pocket-Sized Terminal For Mobile Python Hacking | Hackaday
December 28, 2019 - Inspired by the good old days when your computer would boot directly into BASIC, [Le Roux Bodenstein] has created a handheld device he calls “DumbDumb” that can drop you into a MicroPython environment at a moment’s notice. If that doesn’t interest you, think of it this way: it’s a (relatively) VT100 compatible serial terminal with a physical keyboard that can fit in your pocket.
🌐
Sololearn
sololearn.com › en › Discuss › 2097109 › how-can-i-install-python-in-any-android-terminal-emulator
How can I install python in any Android terminal emulator? | Sololearn: Learn to code for FREE!
Android is a Linux based operating system. So, there must be a way to install python on it's terminal, besides custom packages and apps. How do I install python in Android's terminal? ... ✳AsterisK✳ Oh, I said without any custom packages. By the way, my mobile doesn't support termux.
🌐
DEV Community
dev.to › bauripalash › how-to-run-python-programs-on-android-49bg
Python for Android: How To Run Python Programs On Android - DEV Community
November 24, 2019 - Most of popular Machine Learning and Data Science python libraries are available, making it ideal for testing and experimenting On-The-Go · Try It Yourself , You'll Love it. ... As The name suggests it's a terminal emulator for Android so as usual you can use it's package manager pkg or apt to install python.
Top answer
1 of 1
3

I worked out the solution by going to the Python-for-Android (Py4A) home and found the script that allows Python3 to run as a "Stand alone" on Android.

There are 3 ways to do this:

  • I created the "standalone.sh" script, saved it at "HOME"(export HOME=/data/data/com.spartacusrex.spartacuside/files), changed its mode to executable, called it and python appeared.

  • I opened the ~/.bashrc and pasted copied in the code:

export EXTERNAL_STORAGE=/mnt/sdcard/com.googlecode.python3forandroid
export PY34A=/data/data/com.googlecode.python3forandroid/files/python3
export PY4A_EXTRAS=$EXTERNAL_STORAGE/extras
PYTHONPATH=$EXTERNAL_STORAGE/extras/python3
PYTHONPATH=${PYTHONPATH}:$PY34A/lib/python3.2/lib-dynload
export PYTHONPATH
export TEMP=$EXTERNAL_STORAGE/extras/python3/tmp
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=$PY34A
export LD_LIBRARY_PATH=$PY34A/lib
$PYTHONHOME/bin/python3 "$@"

Note that this means every time you launch Terminal IDE, you will automatically load Python and find yourself at the Python prompt.

  • To launch Python the normal way, like shown by Lanky Cyril, paste the following code in the .bashrc:
export EXTERNAL_STORAGE=/mnt/sdcard/com.googlecode.python3forandroid
export PY34A=/data/data/com.googlecode.python3forandroid/files/python3
export PY4A_EXTRAS=$EXTERNAL_STORAGE/extras
PYTHONPATH=$EXTERNAL_STORAGE/extras/python3
PYTHONPATH=${PYTHONPATH}:$PY34A/lib/python3.2/lib-dynload
export PYTHONPATH
export TEMP=$EXTERNAL_STORAGE/extras/python3/tmp
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=$PY34A
export LD_LIBRARY_PATH=$PY34A/lib

You will notice that the last line in the second solution has been taken out and put in an executable file "~/python". Here is the code:

  #!/system/bin/sh   
  /data/data/com.googlecode.python3forandroid/files/python3/bin/python3 "$@"

I used the second one so that when I launch Terminal IDE, I get my Python prompt instantly. I installed the third solution so that, should I leave the Python prompt, I have a way to get back in the same terminal session.

🌐
Medium
medium.com › @zigzagyc › python-is-a-popular-programming-language-that-is-widely-used-for-various-purposes-such-as-web-35bb54179983
Python is a popular programming language that is widely used for various purposes such as web…
February 1, 2023 - With its popularity, many developers ... on mobile devices, particularly on Android. In this article, we’ll discuss the different methods to run Python on Android, their pros and cons, and provide step-by-step instructions to get started. ... Termux is a popular terminal emulator app ...
🌐
Qpython
qpython.org
QPython - Learn Python & AI on mobile
Choose your language / 选择语言 · English 中文
🌐
Online Python
online-python.com
Online Python - IDE, Editor, Compiler, Interpreter
Python's source code is freely available to the public, and its usage and distribution are unrestricted, including for commercial purposes. It is widely used for web development, and using it, practically anything can be created, including mobile apps, online apps, tools, data analytics, machine learning, and so on.
🌐
Medium
medium.com › nerd-for-tech › easy-way-to-code-python-on-android-4d72b8d99fab
Easy Way to Code Python on Android | by Sean | Nerd For Tech | Medium
November 30, 2025 - What Acode looks like when I’m writing Python. ... Termux is an Android terminal emulator. It is the easiest way to create a Linux-like environment on Android without having to root your phone.