Python is one of the most widely used programming languages in the world. With its simple and easy to learn syntax, Python is a popular choice for beginners and experienced developers. Python is quite a versatile programming language. It can be used to build all kinds of applications, from simple scrips to sophisticated machine learning algorithms.
Debian 10 includes Python version 3.7, which can be installed or updated using the apt
tool.
At the time of writing, Python 3.8 is the latest major release of the Python language. It includes many new features such as assignment expressions, positional-only parameters, f-strings support, and more . Python 3.8 is not available in the standard Debian 10 repositories.
This tutorial covers how to install Python 3.8 on Debian 10. We’ll also show you how to create a virtual environment.
Installing Python 3.8 on Debian 10
Building Python 3.8 on Debian is a relatively straightforward process and will only take a few minutes.
Debian Linux ships with both Python 3 and Python 2 pre-installed. To make sure that our versions are up-to-date, let’s update and upgrade the system with the apt command to work with the Advanced Packaging Tool:
$ sudo apt update $ sudo apt -y upgrade
The -y flag will confirm that we are agreeing for all items to be installed.
Once the process is complete, we can check the version of Python 3 that is installed in the system by typing:
$ python3 -V
You’ll receive output in the terminal window that will let you know the version number. While this number may vary, the output will be similar to this:
Output Python 3.7.3
To manage software packages for Python, let’s install pip, a tool that will install and manage programming packages we may want to use in our development projects. You can learn more about modules or packages that you can install with pip by reading “How To Import Modules in Python 3.”
$ sudo apt install -y python3-pip
Python packages can be installed by typing:
$ pip3 install package_name
Here, package_name can refer to any Python package or library, such as Django for web development or NumPy for scientific computing. So if you would like to install NumPy, you can do so with the command pip3 install numpy.
There are a few more packages and development tools to install to ensure that we have a robust set-up for our programming environment:
$ sudo apt install build-essential libssl-dev libffi-dev python3-dev
Once Python is set up, and pip and other tools are installed, we can set up a virtual environment for our development projects.
We will tell you about this in the following articles.