How to Install Python on Android using Termux [No Root]

install python on android

Are you looking for a step-by-step guide to installing offline python 3 IDE or emulators on android device or tablet without root? Then you are at the right plac. [Run python on android without root]

Table of Contents

Introduction

Python is a widely used and the most popular programming language for data science, data analytics, automation, trading bot, and building big websites. Python is used by big enterprises like Google, Instagram for prototyping.

Python is a versatile and a platform independent language that means you can run py scripts on Linux, Windows, android or any other devices.

There are several offline python IDE or emulators that you can download and install on your android device in just a couple of seconds. However, searching a highly reliable IDE which can perfectly fit your device might be a headache for you, if you are a beginner.

And so, I would recommend you try Termux. Termux is a highly reliable and a lightweight terminal emulator which not only provides you to execute python script on your device, but also gives you various options to try C++, R, Perl, JavaScript Node.js, Ruby scripting, SLA4A projects.

Now Let’s understand how to install termux on android and then we will see how to run python 3 on termux.

How to Install Termux on Android Without Root

Termux is an open-source project of which source code is freely available on github. It ensures us that termux is reliable and secure.

There are two different versions of Termux available to download – Google PlayStore and F-Droid version. There are lots of Add-on to Termux available that you can integrate. It is recommended to install termux from F-droid official website so that you can also use Add-on for free. These Add-on are not free on Google Playstore.

Step by step guide:

  1. First, download and install the official F-droid app. Click here [You will find download link at the bottom of the page in the official site]
  2. Afterward, open the app and search for ‘Termux’ and then install the app as usual. Installation might take some time as per your internet speed.
  3. That’s it. Termux is installed on your device.

Now let’s see how to run python on termux.

How to install Python 2 on Termux

To install Python 2 on your android device using termux, use the below step by step guide:

Step by step guide

  1. First, Open Termux.
  2. We need to upgrade the packages. So type and run the ‘apt update && apt upgrade’ command without quotes.
  3. Once the packages get updated. Type and run the “apt-get python2” command without quotes. Python is a 25 mb long file. Now Termux will ask you to provide Y/n (Yes/NO command). You need to type Y in order to proceed further. See below Screenshot

    install python3 in termux on android
  4. Wait until the Python packages get installed along with the pip package manager.
  5. Once it’s completed. You need to run the “python” command without quotes. Afterward you can run python syntax.
  6. That’s it.

How to install Python 3 on Termux

To install Python 3 on your android device using termux, use the below step by step guide:

Step by step guide

  1. First, Open Termux.
  2. We need to upgrade the packages. So type and run the ‘apt update && apt upgrade’ command without quotes.
  3. Once the packages get updated. Type and run the “apt-get python3” command without quotes. Now Termux will ask you to provide Y/N (Yes/NO command). Type Y in order to proceed further.
  4. Wait until the Python packages get installed.
  5. Once it’s completed. You need to run the “python3” command without quotes. And then you can run python3 syntax.
  6. That’s it.

Don’t forget to permit Termux to access SD card storage. Read further.

How to enable SD card storage access in Termux

There are two ways to allow termux to get access to internal or sd card storage access.

Method 1: Guide

  1. Open Termux.
  2. And type and run the “termux-setup-storage” command without quotes.
  3. A pop-up box will appear asking you to allow the media access. Then allow it as usual. You can see the below screenshot

  4. That’s it.

Method 2:

You can also permit access to media storage without command. You just need to navigate to device settings > Apps > Termux.

You will find there an option “App permissions”. Just tap on it and then allow media access to the termux app.

Popular Add-on which you must try

I have featured some most popular and useful add-on which you can use to enhance your android device. These add-on are paid apps on google play store. And so if you want these add-on for free then you have to use the f-droid app, a free and open source project.

The useful addons are:

1. Termux:Boot – Sometimes you might like to run python script(s) when your device boots.
2. Termux:Float – Sometimes you might also like to run Termux in a floating window.
3. Termux:Styling – This add-on provides color schemes and powerline-ready fonts to customize the appearance of the Termux terminal.
4. Termux:Task – Provides an easy way to call Termux executables from Tasker and compatible apps.
5. Termux:Widget – Provides an easy way to start small python scriptlets from the home screen.

Conclusion

There are hundreds, even thousands of python IDE or terminal emulators available across the app store which allows you to run python on android without root, but no one can compete with Termux emulator.

Termux provides a high level of flexibility that you can build your own add-on by following the official documentation. It also helps you to install node.js, C++ packages so that you can get a wide variety of experience.

Some features: Pip package manager, scientific libraries, such as numpy, scipy, matplotlib, scikit-learn and jupyter, Tensorflow, ML projects, Nano editor, Python pandas support, Node js support, Hosting website, Xampp server, Metasploit Framework, stc.

Thanks.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.