Serverspace Black Friday
DF
May 18, 2023
Updated June 9, 2023

Installing the latest version of Python on Debian

Debian Python

Using another OS?

Select the desired version or distribution.

Python is a popular programming language at the present time due to its speed, portability of programs written in it, and a relatively low entry threshold for novice developers. The material below will describe the process of upgrading to version 3.10.9 of this language packages on a host running Debian OS.

Updating the system software of the operating system

We will execute all commands as the root user, for this we execute: sudo -i First of all, let's update the OS itself:

apt-get install sudo -y
apt-get install aptitude
aptitude update
aptitude upgrade

After the OS update is complete, let's look at the current available language support libraries:

Python3 -V

Install dependent software, compile

sudo apt install wget software-properties-common
apt-get install build-essential
aptitude install build-essential libncursesw5-dev libreadline-gplv2-dev libssl-dev libsqlite3-dev tk-dev libc6-dev libbz2-dev libffi-dev -y

Download the actual file, unpack it to an arbitrary location:

wget https://www.python.org/ftp/python/3.11.3/Python-3.11.3.tgz
tar xvf Python-3.11.3.tgz

Moving to location:

cd Python-3.11.3/

Then we compile:

./configure --enable-optimizations

And then install:

make install

Check if the update is correct

Insert this:

python3 -V

You can also check by creating a simple script and running it:

touch test.py

Let's make it executable:

chmod +x test.py

Let's paste the contents into this file :

echo "print('Hello, world')">test.py

And let's run:

/usr/bin/python3 test.py

As a result, a message will be displayed on the screen.

Hello, world

Removing temporary files

If there is no need for previously downloaded archive files, they can be deleted as follows:

cd .. Rm -rf Python-3.1.* sudo aptitude clean

Outcome

Now ready to use the updated version of Python on the server.

You may be also interested in

Vote:
4 out of 5
Аverage rating : 4.5
Rated by: 3
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.