How To Install python-cheetah on Ubuntu 18.04

In this tutorial we learn how to install python-cheetah on Ubuntu 18.04. python-cheetah is text-based template engine and Python code generator

Introduction

In this tutorial we learn how to install python-cheetah on Ubuntu 18.04.

What is python-cheetah

python-cheetah is:

Cheetah can be used as a standalone templating utility or referenced as a library from other Python applications. It has many potential uses, but web developers looking for a viable alternative to ASP, JSP, PHP and PSP are expected to be its principle user group.

Features:

  • Generates HTML, SGML, XML, SQL, Postscript, form email, LaTeX, or any other text-based format.
  • Cleanly separates content, graphic design, and program code.
  • Blends the power and flexibility of Python with a simple template language that non-programmers can understand.
  • Gives template writers full access to any Python data structure, module, function, object, or method in their templates.
  • Makes code reuse easy by providing an object-orientated interface to templates that is accessible from Python code or other Cheetah templates. One template can subclass another and selectively reimplement sections of it.
  • Provides a simple, yet powerful, caching mechanism that can dramatically improve the performance of a dynamic website.
  • Compiles templates into optimized, yet readable, Python code.

There are three methods to install python-cheetah on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-cheetah Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-cheetah using apt-get by running the following command:

sudo apt-get -y install python-cheetah

Install python-cheetah Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-cheetah using apt by running the following command:

sudo apt -y install python-cheetah

Install python-cheetah Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-cheetah using aptitude by running the following command:

sudo aptitude -y install python-cheetah

How To Uninstall python-cheetah on Ubuntu 18.04

To uninstall only the python-cheetah package we can use the following command:

sudo apt-get remove python-cheetah

Uninstall python-cheetah And Its Dependencies

To uninstall python-cheetah and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-cheetah

Remove python-cheetah Configurations and Data

To remove python-cheetah configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-cheetah

Remove python-cheetah configuration, data, and all of its dependencies

We can use the following command to remove python-cheetah configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-cheetah

References

Summary

In this tutorial we learn how to install python-cheetah package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.