How To Install python-twitter on Ubuntu 18.04

In this tutorial we learn how to install python-twitter on Ubuntu 18.04. python-twitter is Twitter API wrapper for Python

Introduction

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

What is python-twitter

python-twitter is:

This library provides a pure Python interface for the Twitter API.

Twitter provides a service that allows people to connect via the web, IM, and SMS. Twitter exposes a web services API (http://twitter.com/help/api) and this library is intended to make it even easier for Python programmers to use.

There are three methods to install python-twitter 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-twitter 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-twitter using apt-get by running the following command:

sudo apt-get -y install python-twitter

Install python-twitter Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-twitter

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

sudo aptitude -y install python-twitter

How To Uninstall python-twitter on Ubuntu 18.04

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

sudo apt-get remove python-twitter

Uninstall python-twitter And Its Dependencies

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

sudo apt-get -y autoremove python-twitter

Remove python-twitter Configurations and Data

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

sudo apt-get -y purge python-twitter

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

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

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

References

Summary

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