Giuseppe Parrello

 

How to install the Python interpreter


In this page I will describe how to install the Python interpreter on a router (Asus RT-AC56U) - we use some Entware packages, so please refer to this page on how to install Entware on a router.
On Entware, Python interpreter is available in 3.x release (2.x release is not supported anymore, as described on official Internet website of "Python Software Foundation"). Here, in this page, we will explain how to install this release. Keep in mind that on this website, several pages will refer to package "PIP", so we will provide you with simple instructions on how to install the above-mentioned package "PIP" without installing all the Python package.


How to install the Python interpreter - release 3.x

To install only the basic Python package, use the command line "opkg install python3", this comand will install the Python interpreter and the most important libraries.
To install only the "PIP" package, use the command line "opkg install python3-pip", this comand will install the Python interpreter and the most important libraries, as well as the "PIP" package.
To install the Python interpreter and all its libraries, firstly we have to know which are the packages to be installed; use the command line "opkg list | grep -i python3-" to have a list of packages to be installed and run a command "opkg install [package name]" to install each one of them. The most practical method is to create one script in order to install all packages. Here is a simple script example.

#!/bin/sh

opkg install python3
opkg install python3-asn1crypto
opkg install python3-asyncio
opkg install python3-base
opkg install python3-cffi
opkg install python3-cgi
opkg install python3-cgitb
opkg install python3-codecs
opkg install python3-cryptography
opkg install python3-ctypes
opkg install python3-dbm
opkg install python3-decimal
opkg install python3-dev
opkg install python3-distutils
opkg install python3-email
opkg install python3-gdbm
opkg install python3-idna
opkg install python3-lib2to3
opkg install python3-light
opkg install python3-logging
opkg install python3-lxml
opkg install python3-lzma
opkg install python3-multiprocessing
opkg install python3-ncurses
opkg install python3-openssl
opkg install python3-pip
opkg install python3-ply
opkg install python3-pyasn1
opkg install python3-pycparser
opkg install python3-pydoc
opkg install python3-pyopenssl
opkg install python3-requests
opkg install python3-setuptools
opkg install python3-six
opkg install python3-sqlite3
opkg install python3-unittest
opkg install python3-xml
opkg install python3-yaml

How to remove the Python interpreter - release 3.x

To remove the Python interpreter and all its libraries, firstly we have to know which are the packages to be removed; use the command line "opkg list_installed | grep -i python3-" to have a list of packages to be removed and run a command "opkg remove [package name]" to remove each one of them. The most practical method is to create one script in order to remove all packages. Here is a simple script example.

#!/bin/sh

opkg --force-depends remove python3
opkg --force-depends remove python3-asn1crypto
opkg --force-depends remove python3-asyncio
opkg --force-depends remove python3-base
opkg --force-depends remove python3-cffi
opkg --force-depends remove python3-cgi
opkg --force-depends remove python3-cgitb
opkg --force-depends remove python3-codecs
opkg --force-depends remove python3-cryptography
opkg --force-depends remove python3-ctypes
opkg --force-depends remove python3-dbm
opkg --force-depends remove python3-decimal
opkg --force-depends remove python3-dev
opkg --force-depends remove python3-distutils
opkg --force-depends remove python3-email
opkg --force-depends remove python3-gdbm
opkg --force-depends remove python3-idna
opkg --force-depends remove python3-lib2to3
opkg --force-depends remove python3-light
opkg --force-depends remove python3-logging
opkg --force-depends remove python3-lxml
opkg --force-depends remove python3-lzma
opkg --force-depends remove python3-multiprocessing
opkg --force-depends remove python3-ncurses
opkg --force-depends remove python3-openssl
opkg --force-depends remove python3-pip
opkg --force-depends remove python3-ply
opkg --force-depends remove python3-pyasn1
opkg --force-depends remove python3-pycparser
opkg --force-depends remove python3-pydoc
opkg --force-depends remove python3-pyopenssl
opkg --force-depends remove python3-requests
opkg --force-depends remove python3-setuptools
opkg --force-depends remove python3-six
opkg --force-depends remove python3-sqlite3
opkg --force-depends remove python3-unittest
opkg --force-depends remove python3-xml
opkg --force-depends remove python3-yaml
opkg --force-depends remove python-pip-conf