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 -yapt-get install aptitudeaptitude updateaptitude upgradeAfter the OS update is complete, let's look at the current available language support libraries:
Python3 -VInstall dependent software, compile
sudo apt install wget software-properties-commonapt-get install build-essentialaptitude 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.tgztar xvf Python-3.11.3.tgzMoving to location:
cd Python-3.11.3/Then we compile:
./configure --enable-optimizationsAnd then install:
make installCheck if the update is correct
Insert this:
python3 -VYou can also check by creating a simple script and running it:
touch test.pyLet's make it executable:
chmod +x test.pyLet's paste the contents into this file :
echo "print('Hello, world')">test.pyAnd let's run:
/usr/bin/python3 test.pyAs a result, a message will be displayed on the screen.
Hello, worldRemoving 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.