Cara upgrade python 2.7 di termux

Kamu suka melakukan oprek maupun ingin belajar bahasa pemrograman dengan mudah melalui smartphone Android? sekarang kamu berada pada tutorial yang tepat dengan bahasan mengenai cara menginstall dan menjalankan perintah python di termux.

Bagi yang belum mengenal tentang termux, aplikasi ini berfungsi sebagai terminal emulator pada Android. Sistem operasi Android yang dibuat berdasarkan kernel Linux membuatnya dapat menjalankan setiap perintah sama halnya di Linux, dikarenakan pada sistem default Android tidak terdapat terminal, maka kita memerlukan aplikasi pihak ketiga.

Pada aplikasi termux kamu bisa menginstall berbagai bahasa pemrograman, salah satunya python. sehingga kamu lebih fleksibel dalam menuliskan perintah python hanya dengan memakai smartphone kamu. Langsung saja berikut langkah-langkah menginstall dan menjalankan perintah python di termux.

Tutorial

1. Silahkan kamu download terlebih dahulu aplikasi termux di Google Play Store, atau bisa melalui link di bawah. Kemudian install dan jalankan aplikasi tersebut.

Download termux

2. Sesudah aplikasinya terbuka ketikan perintah ” apt-get update && apt-get upgrade “. Perintah tersebut berguna untuk memperbarui paket aplikasi, sehingga nantinya paket yang kamu install di termux merupakan versi yang terbaru.

Cara upgrade python 2.7 di termux

3. Setelah melakukan update & upgrade, saatnya kita menjalankan perintah menginstall python. Silahkan kamu ketikan ” apt-get install python “. Saat pertama kali menginstall sesuatu di termux kamu akan ditanyakan proses perizinan, ketikan ” y ” untuk melanjutkan.

Cara upgrade python 2.7 di termux

4. Proses install akan memakan waktu beberapa menit tergantung koneksi internet kamu. Setelah prosesnya selesai, untuk menjalankan python ketikan perintah ” python “.

Cara upgrade python 2.7 di termux

5. Kemudian akan langsung muncul baris perintah untuk menuliskan kode pemrograman python.

Cara upgrade python 2.7 di termux

6. Sampai di sini silahkan kamu tuliskan kode perintah python sesuai keinginan, disini saya mencontohkan baris kode sederhana berupa perhitungan dasar matematika.

Cara upgrade python 2.7 di termux

Demikian tutorial menginstall dan menjalankan python pada termux. Semoga bermanfaat.

Cara upgrade python 2.7 di termux

- Advertisement -

Cara upgrade python 2.7 di termux

Many users have experienced difficulty installing python2 and python3 on Termux. So, in this blog, I will share a step-by-step guide on how you can install python2 and python3 in Termux.

Why install python2 when there is python3 available?

Many programs are written using python2, and If one will try to run those programs in python3, they will show errors like Indentation error. For that, one needs to have python2 installed to run the programs that require python2.

How to install both python2 and python3 in Termux?

Follow these simple commands to install python2 and 3 in your Termux

  • apt update && apt upgrade – This will update the list and also upgrade the available packages
  • apt install python – Installs Python3
  • apt install python2 – Installs Python2
apt update && apt upgrade

apt install python

apt install python2

How to use python2 and python3 ?

If you type python example.py, Termux will automatically open that program with python3. To use python2, you need to type python2 example.py. This way, you can specifically tell Termux to use python2 instead of the default python3 version.

The same goes for pip, if you use pip install example, this will automatically use pip version 3 to install packages. To install packages from pip version 2, use pip2 install example.

This will allow you to use both python2 and python3, according to your need. To use python2, type python2, and for python 3, type python3, or type python to use python3 by default.

Installing any version of python in termux

You can install any python version by specifying the version before installing it.

For example: To install python v3.9.4, you can enter thecommand apt install python=3.9.4. With this command, it will search for a specified version. If that version is available, the package manager will install it. If it is not available, you’ll get an error indicating that “this version cannot be found.”

So this is how you can install a specified python version and use it according to what you need. Give it a try, and let me know if this helps.

- Advertisement -

Read Also : Top 5 Best Information Gathering Tools For Termux

- Advertisement -