You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Python is a programming and scripting language developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use. The management and control of the development is under the Python Software Foundation. As of this article update the latest release of the Python is 3.9.x. We will demonstrate how Linux users can install Python 3.9 on Debian 10 system.

Python is an easy to learn language, with clean and simple syntax making it quick choice to new and experienced developers. Python can be used to build Desktop applications, automation scripts, Web applications, Games, Big data applications among many others. The first step in Python development journey is the software installation.

Install Python 3.9 on Debian 10

Update your APT cache index before installation of Python 3.9 on Debian 10 system.

sudo apt update

If upgrade is possible then run the commands below.

sudo apt upgrade -y

Then restart the system after a successful upgrade.

sudo reboot

After the system is rebooted, install dependency packages:

sudo apt install wget software-properties-common build-essential libnss3-dev zlib1g-dev libgdbm-dev libncurses5-dev   libssl-dev libffi-dev libreadline-dev libsqlite3-dev libbz2-dev

Hit the y key to begin installation:

0 upgraded, 95 newly installed, 0 to remove and 0 not upgraded.
Need to get 74.7 MB of archives.
After this operation, 296 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Visit Python Downloads page and pull the latest release.

wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz

Extract the downloaded file.

tar xvf Python-3.9.2.tgz

Change working directory to create Python folder:

cd Python-3.9.2/

Run configuration command

./configure --enable-optimizations

Sample output:

....
checking for shm_open... yes
checking for shm_unlink... yes
checking for pkg-config... no
checking for openssl/ssl.h in /usr/local/ssl... no
checking for openssl/ssl.h in /usr/lib/ssl... no
checking for openssl/ssl.h in /usr/ssl... no
checking for openssl/ssl.h in /usr/pkg... no
checking for openssl/ssl.h in /usr/local... no
checking for openssl/ssl.h in /usr... no
checking whether compiling and linking against OpenSSL works... no
checking for --with-ssl-default-suites... python
checking for --with-builtin-hashlib-hashes... md5,sha1,sha256,sha512,sha3,blake2
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Misc/python.pc
config.status: creating Misc/python-embed.pc
config.status: creating Misc/python-config.sh
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
config.status: pyconfig.h is unchanged
creating Modules/Setup.local
creating Makefile

Build Python 3.9 on Debian 10 Linux:

sudo make altinstall

A successful installation will have output similar to below:

....
changing mode of /usr/local/lib/python3.9/lib-dynload/__pycache__ to 755
running install_scripts
copying build/scripts-3.9/idle3.9 -> /usr/local/bin
copying build/scripts-3.9/pydoc3.9 -> /usr/local/bin
copying build/scripts-3.9/2to3-3.9 -> /usr/local/bin
changing mode of /usr/local/bin/idle3.9 to 755
changing mode of /usr/local/bin/pydoc3.9 to 755
changing mode of /usr/local/bin/2to3-3.9 to 755
rm /usr/local/lib/python3.9/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py
rm -r /usr/local/lib/python3.9/lib-dynload/__pycache__
/usr/bin/install -c -m 644 ./Misc/python.man \
	/usr/local/share/man/man1/python3.9.1
if test "xupgrade" != "xno"  ; then \
	case upgrade in \
		upgrade) ensurepip="--altinstall --upgrade" ;; \
		install|*) ensurepip="--altinstall" ;; \
	esac; \
	 ./python -E -m ensurepip \
		$ensurepip --root=/ ; \
fi
Looking in links: /tmp/tmpog4qrruc
Requirement already up-to-date: setuptools in /usr/local/lib/python3.9/site-packages (49.2.1)
Requirement already up-to-date: pip in /usr/local/lib/python3.9/site-packages (20.2.3)

Running the commands below will output the version of Python 3.9 available in your system:

$ python3.9 --version
Python 3.9.2

To install Python modules available in modules releases page, use the command syntax:

python3.9 -m pip install <module>

Conclusion

In this short guide we’ve shown you how to install Python 3.9 on Debian 10 Linux. If you’re using this guide at a later date in time, a similar process applies.

You can check other articles in our website on Debian 10 system management:

How To Install Docker Swarm Cluster on Debian

Install CloudPanel Control Panel on Debian

As an appreciation for the content we put out,
we would be thrilled if you support us!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here