How To Install cython on Ubuntu 20.04
Introduction
In this tutorial we learn how to install cython
on Ubuntu 20.04.
What is cython
cython is:
Cython is a language that makes writing C extensions for the Python language as easy as Python itself. Cython is based on the well-known Pyrex, but supports more cutting edge functionality and optimizations.
The Cython language is very close to the Python language, but Cython additionally supports calling C functions and declaring C types on variables and class attributes. This allows the compiler to generate very efficient C code from Cython code.
This makes Cython the ideal language for wrapping external C libraries, and for fast C modules that speed up the execution of Python code.
There are three methods to install cython
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 cython Using apt-get
Update apt database with apt-get
using the following command.
sudo apt-get update
After updating apt database, We can install cython
using apt-get
by running the following command:
sudo apt-get -y install cython
Install cython Using apt
Update apt database with apt
using the following command.
sudo apt update
After updating apt database, We can install cython
using apt
by running the following command:
sudo apt -y install cython
Install cython 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 cython
using aptitude
by running the following command:
sudo aptitude -y install cython
How To Uninstall cython on Ubuntu 20.04
To uninstall only the cython
package we can use the following command:
sudo apt-get remove cython
Uninstall cython And Its Dependencies
To uninstall cython
and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:
sudo apt-get -y autoremove cython
Remove cython Configurations and Data
To remove cython
configuration and data from Ubuntu 20.04 we can use the following command:
sudo apt-get -y purge cython
Remove cython configuration, data, and all of its dependencies
We can use the following command to remove cython
configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge cython
References
Summary
In this tutorial we learn how to install cython
package on Ubuntu 20.04 using different package management tools: apt
, apt-get
and aptitude
.