DEV Community

Stephano Kambeta
Stephano Kambeta

Posted on

Python in Termux: A Step-by-Step Beginner's Guide

Want to learn Python but only have an Android phone? Termux gives you a lightweight Linux terminal on mobile so you can install Python, run scripts, and practice coding anywhere. This step-by-step guide walks you from zero to running your first Python script in minutes.

Read the full guide: How to Install and Use Python in Termux for Beginners

Why Termux for Python

  • Use only your phone, no laptop required
  • Works on budget devices with low storage
  • Run scripts offline once Python is installed
  • Great for quick experiments and learning on the go

What this guide covers

  • Update Termux safely to avoid install errors
  • Install Python with a single command
  • Open the Python REPL and run commands
  • Create and run .py scripts
  • Install packages using pip
  • Project ideas to practice and build skills

Quick start commands

Copy these exact commands into Termux to follow along.

pkg update && pkg upgrade -y pkg install python -y python --version python 

Create and run a simple script:

nano hello.py print("Hello from Termux") python hello.py 

Beginner projects to try

  • Calculator: Take two numbers and perform operations
  • To-do list: Add, view, and remove tasks in a text file
  • Password generator: Create strong random passwords
  • Weather checker: Use an API to fetch weather data

Common problems and fixes

  • Python command not found: Run pkg install python -y again
  • Pip issues: Update pip with pip install --upgrade pip
  • Permission or save errors: Ensure you are in your home folder with cd ~
  • Need phone storage access: Run termux-setup-storage

Tips to keep learning

  • Write small scripts every day to build habit
  • Organize projects in a folder like python_projects
  • Use pip to add useful libraries when needed
  • Read errors carefully; they usually tell you what to fix

This guide is built for beginners who want a clean, safe path into Python using only their phone. Ready to start? Read the full step-by-step tutorial and run your first script today.

Top comments (0)