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.
- Start by installing the packages necessary to build Python source:
Copysudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev liblzma-dev
- Download the latest release’s source code from the Python download page with wget or curl. At the time of writing this article, the latest release is 3.8.2:
Copycurl -O https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
- When the download is complete, extract the tarball:
Copytar -xf Python-3.8.2.tar.xz
- Navigate to the Python source directory and run the configure script:
Copycd Python-3.8.2
./configure --enable-optimizations --enable-loadable-sqlite-extensions
The script performs a number of checks to make sure all of the dependencies on your system are present. The --enable-optimizations option will optimize the Python binary by running multiple tests, which will make the build process slower.
- Run make to start the build process:
Copymake -j 4
Modify the -j to correspond to the number of cores in your processor. You can find the number by typing nproc.
- Once the build is done, install the Python binaries by running the following command as a user with sudo access:
Copysudo make altinstall
Do not use the standard make install as it will overwrite the default system python3 binary.
- At this point, Python 3.8 is installed on your Debian system and ready to be used. You can verify it by typing:
Copypython3.8 --version
Python 3.8.2
source: https://linuxize.com/post/how-to-install-python-3-8-on-debian-10/
Answer from alex_noname on Stack OverflowInstalling python3.8 on Debian 10
Is it safe to install python-3.8 on Debian 10
How to install a specific python version on Debian 12?
Debian Bullseye "Could not import python modules: apt, apt_pkg. Please install python3-apt package."
The best solution is to run the playbook with increase verbosity so it can tell you the inside error
More on reddit.comAre there alternative methods for installing Python on Debian?
Yes, besides APT, you can also install Python from source or use third-party package managers like Conda. However, using APT is the recommended and simplest method for most users.
Which package manager should I use to install Python on Debian?
Debian systems typically use the Advanced Package Tool (APT) for package management. You can use APT to install Python.
What is Python?
Python is a high-level, interpreted programming language known for its simplicity and versatility. It's widely used for various purposes, including web development, data analysis, artificial intelligence, and more.
Videos
Preface: using Debian 10 on a Google Cloud VM
I just installed python3.8 using this site here: https://linuxize.com/post/how-to-install-python-3-8-on-debian-10/ . The install worked and can be confirmed checking the version. python3.8 --version = 3.8.2. After installation I'm left with a few questions and issues.
When checking /home/js04/usr/lib I see "python2", "python3", and "python3.7" but NOT "python3.8". However, when I navigate to /home/js04/.local/lib I see "python3.7" and "python3.8". Is this normal? Should "python3.8" be in /usr/lib?
Second, after installation I'm left with the folder "Python-3.8.2" and file "Python-3.8.2.tar.xz" in my home directory /home/js04. Can these be deleted for organizational reasons?
I'm trying to backport hexchat 2.14.3 for Buster and mk-build-deps wants python 3.8. I was able to build the python packages but don't know if it's safe to dpkg --install them because python 3.7 is already installed. I've been using this guide: https://wiki.debian.org/SimpleBackportCreation
As per the instructions on How to Install Python 3.8 on Ubuntu, Debian and LinuxMint – TecAdmin, try the following:
Prerequisites:
Install [and or update] the following packages; build-essential, checkinstall, libreadline-gplv2-dev, libncursesw5-dev, libssl-dev, libsqlite3-dev, tk-dev, libgdbm-dev, libc6-dev, libbz2-dev, libffi-dev, zlib1g-dev.
sudo apt install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
Thereafter, change directory (cd) to your opt folder [or any convenient folder] and download the python source code from python's server:
First change directory (cd) to the 'opt' folder:
cd /opt/
Download the source code
sudo wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
Extract the [downloaded] source code files
sudo tar xzf Python-3.8.3.tgz
Change directory (cd) the Python Folder [created after the extraction]
cd Python-3.8.3
Compile the source code
sudo ./configure --enable-optimizations
then
sudo make altinstall
Once the compilation is completed, you can confirm that Python 3.8 has been installed successfully with:
python3.8 -V
You should see the response Python-3.8.3.
However, to precisely answer your question, python 3.8 isn't available via ubuntu official repos. You would have to add a PPA to get python 3.8 using sudo apt install [python3.x.x].
The process is described on How to Install Python 3.8 on Ubuntu 18.04 | Linuxize
Hope this helps and I hope I answered your question adequately.
It looks like Python 3.8 is already installed but not set as default. Python 3.7.6 is set as default.
Update default Python3 version by below command.
sudo update-alternatives --config python3
Choose Python 3.8 option and check Python version again.