How to Install Python, Python2, Python3, and Pip in Termux

How to Install Python, Python2, Python3, and Pip in Termux

How to Install Python, Python2, Python3, and Pip in Termux

Introduction

Python is a versatile programming language widely used for scripting, automation, web development, and more. Termux, a terminal emulator for Android, allows you to install and run Python seamlessly. In this guide, we will show you how to install Python, Python2, Python3, and Pip in Termux.

1. Update and Upgrade Termux Packages

Before installing Python, it is always recommended to update and upgrade the package lists to ensure the latest versions are available.

pkg update && pkg upgrade -y

2. Installing Python

To install Python (which defaults to Python3), run the following command:

pkg install python -y

After installation, you can verify the installed version:

python --version

3. Installing Python2

Some older scripts or applications may require Python2. To install Python2, use:

pkg install python2 -y

Verify the installation with:

python2 --version

4. Installing Python3 (Explicitly)

If you need to explicitly install Python3, use:

pkg install python3 -y

Check the installed version:

python3 --version

5. Installing Pip (Python Package Manager)

Pip is essential for managing Python packages. It is usually installed along with Python, but if missing, install it manually:

pkg install python-pip -y

Verify the installation:

pip --version

6. Upgrading Pip

To ensure you have the latest version of Pip, upgrade it using:

pip install --upgrade pip

Conclusion

Now you have Python, Python2, Python3, and Pip successfully installed in Termux. You can start running Python scripts and installing libraries for development, automation, and more. Happy coding! 🚀

Post a Comment

Previous Post Next Post