How To Install python3-lxml on Ubuntu 20.04

In this tutorial we learn how to install python3-lxml on Ubuntu 20.04. python3-lxml is pythonic binding for the libxml2 and libxslt libraries pythonic binding for the libxml2 and libxslt libraries

Introduction

In this tutorial we learn how to install python3-lxml on Ubuntu 20.04.

What is python3-lxml

python3-lxml is:

lxml is a new Python binding for libxml2 and libxslt, completely independent from existing Python bindings. Its aim:

  • Pythonic API.
  • Documented.
  • Use Python unicode strings in API.
  • Safe (no segfaults).
  • No manual memory management!

lxml aims to provide a Pythonic API by following as much as possible the ElementTree API, trying to avoid inventing too many new APIs, or the user’s having to learn new things – XML is complicated enough. Task: ubuntustudio-publishing, ubuntukylin-desktop

Package: python3-lxml Architecture: amd64 Version: 4.5.0-1 Multi-Arch: same Priority: optional Section: python Source: lxml Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Matthias Klose [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 4837 Provides: python3.8-lxml Depends: python3 (« 3.9), python3 (>= 3.8~), python3:any, libc6 (>= 2.14), libxml2 (>= 2.9.0), libxslt1.1 (>= 1.1.26) Recommends: python3-bs4, python3-html5lib Suggests: python3-lxml-dbg, python-lxml-doc Filename: pool/main/l/lxml/python3-lxml_4.5.0-1_amd64.deb Size: 1381428 MD5sum: 7125d2999876fe65f444532f5ccb0c60 SHA1: c72d29d8286384ba53251fff072f119e36617d56 SHA256: 34eecc1be92f9f02663f14e92ad2f74e3266d2c4a4eea0dd87da23b78eb1ee2f Homepage: http://lxml.de/ Description-en: pythonic binding for the libxml2 and libxslt libraries lxml is a new Python binding for libxml2 and libxslt, completely independent from existing Python bindings. Its aim:

  • Pythonic API.
  • Documented.
  • Use Python unicode strings in API.
  • Safe (no segfaults).
  • No manual memory management!

lxml aims to provide a Pythonic API by following as much as possible the ElementTree API, trying to avoid inventing too many new APIs, or the user’s having to learn new things – XML is complicated enough. Task: ubuntustudio-publishing, ubuntukylin-desktop

There are three methods to install python3-lxml on Ubuntu 20.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 python3-lxml Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install python3-lxml

Install python3-lxml Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python3-lxml

Install python3-lxml 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 python3-lxml using aptitude by running the following command:

sudo aptitude -y install python3-lxml

How To Uninstall python3-lxml on Ubuntu 20.04

To uninstall only the python3-lxml package we can use the following command:

sudo apt-get remove python3-lxml

Uninstall python3-lxml And Its Dependencies

To uninstall python3-lxml and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove python3-lxml

Remove python3-lxml Configurations and Data

To remove python3-lxml configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge python3-lxml

Remove python3-lxml configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge python3-lxml

References

Summary

In this tutorial we learn how to install python3-lxml package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.