Using Python in Terminal on Android OS  without Root Access

Hello,everyone.Today,I am going to share how to use Python in Terminal on Android phone without Root Access.This post is made for them who do not use Rooted phone or those who do not want to Root.

I had thought that it would not be possible to use Python in Terminal without Root Access.Python scripts can also be run using Sl4A , but I find using Python in Terminal better as Sl4a has no option of changing directory.Running Python files is easier in Terminal.So,let us proceed to the tutorial.

Tools Required: 

1. Python For Android.apk: Download Here

2.Terminal.apk :  Download Here

3. Python.sh: Download Here

4. Sl4A.apk(optional file): Download Here 
Steps: 

1.Download all of the above files if you do not have.Install Python For Android app. You can also install Sl4A app if you want.

2.Open Python For Android app and click on Install button to install Python library on your phone .Internet is required for first time installation.After successful installation of Python library,your screen should be like as shown in screenshot given below:

3.Now,copy Python.sh file to your internal memory sdcard  as shown in the screenshot.

3.Now,open Terminal app.To run Python,type these carefully as shown in screenshot:

sh  /sdcard/python.sh 

4.If everything is fine,you will see Python successfully running on Terminal.If,you get error as Python.sh file not found,make sure that python.sh is there in internal sdcard(/sdcard ).

5.To run a script file say hello.py of folder scripts in your sdcard(/sdcard/scripts folder) as shown in screenshot:

we need to type the following command carefully to run hello.py file( /sdcard/scripts/hello.py ) as shown in screenshot below :

cd /sdcard/scripts

sh  /sdcard/python.sh   hello.py

6. In this way you can run any Python file present in current directory on Terminal app by using the following command:

sh  /sdcard/Python.sh  filename.py

Now,you can use Python and Python Scripts on all  Android OS without Root Access in the way shown above.Tutorial is complete now.

I hope this tutorial will be useful for many users.Thanks everyone for reading my post.

If you have any questions or you get any error,please contact me by posting your comments.

Share this if you really like it.

©gauravssnl

2 thoughts on “Using Python in Terminal on Android OS  without Root Access

  1. I’m running on KitKat and non rooted phone. Whenever, I typed “CD” terminal seems not recognized it.

    Here’s the code:

    u0_a117@S820_ROW:/ $ sh sdcard/python.sh
    Python 2.7.11 (default, Mar 21 2016, 16:38:01)
    [GCC 4.8] on linux-armv7l
    Type “help”, “copyright”, “credits” or “license” for more information.
    >>> cd
    Traceback (most recent call last):
    File “”, line 1, in
    NameError: name ‘cd’ is not defined
    >>> sh
    Traceback (most recent call last):
    File “”, line 1, in
    NameError: name ‘sh’ is not defined
    >>> cd sdcard/scripts/python.sh hello_world.py
    File “”, line 1
    cd sdcard/scripts/python.sh hello_world.py
    ^
    SyntaxError: invalid syntax
    >>>

Leave a reply to gauravssnl Cancel reply