Are you looking for a step by step guide to install Colorama for python in Termux android? Then you are at the right place.
Colorama is a popular module that provides an easy to use API to print colored text on terminal from python scripting. The module provides a lot of native features, which works on Linux as well as Windows terminal, such as color escape characters, changing background as well as text color, etc. The default windows terminal, however, supports all the color escape codes without any plugin. The best thing about the Colorma for python is that it provides you a very easy to use API to colorize the output as per your desire by using escape characters. You can use the Colorama command in the print function as well.
Before jumping into the process of installing Colorama packages in your termux emulator, you have to make sure that Python 2 or Python 3 is correctly installed in your terminal. If you did not install the python in your termux yet, then follow the below steps otherwise skip it.
How to install Python 3 in android using Termux emulator
Python3.8 is the latest update from the python community that supports the updated versions of api, uses 11% less memory than python 3.7, and Other optimizations includes faster file copying with shutil, faster operator, better performance in subprocess, improved default performance in pickle, itemgetter operations.
To install the latest python 3.8 update follow my latest article, here. (click here)
How to install Colorama for python in Termux
First of all, you need to make sure that Python is installed on your device, Otherwise you can follow this tutorial to install Python on your device. Once, python is successfully installed, you can now follow the below step by step guide:
Step 1: Upgrade Packages
The very first thing which you need to do is upgrade all the packages, including security patches of your terminal. For upgrading to the latest version of the packages, run the below command.
apt update && apt upgrade
Step 2: Install Colorama Packages
Now you need to run the below command for installing Colorama packages.
pip install colorama
Step 3: Run Colorama commands
You can now import and use Colorama commands in your termux terminal. As shown in the below para.
from colorama import Fore, Back, Style
print(Fore.RED + red text')
print(Back.GREEN + 'green background')
print(Style.DIM + 'dim text')
print('back to normal')
Frequently asked Questions
How To Fix ImportError: No module named colorama
There might be some packages related issues in your android device. It happens due to the incorrect version of modules. If the pip or pip3 command does not work Then you can go for manually installing Colorama packages in your device. Follow the below guide:
- First of all, download the Colorama packages from this link: Download Colorama Packages here.
- Now extract the packages using any extracting tool.
- Then run this command:
python setup.py install
That’s it. Your problem will be solved. Sometimes, Pip fails to download the packages from the source directory. At that time, we have to manually install the packages using the setup command.
Colorama is the best tool when we look at the features and easy to use API of the module. The module comes with a lot of native functionality such as changing background color, text color, font-family. I am fond of Coloram due to its flexible API that cannot be replaced with other add-on’s or modules.
I regularly practice Metasploit in my Termux emulator at my home wifi network for ethical hacking. When I first discovered Colorama I was amazed with the features that it provides. It helps me to log all the errors and other outputs with ease.