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.
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.
Extract the downloaded file.
tar xvf Python-3.9.2.tgz
Change working directory to create Python folder:
Run configuration command
.... 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>
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: