The Python team has released its latest version Python 3.8 for general use. You can download the latest stable version Python 3.8 series and install it on your system. This article will help you to install Python 3.8.12 on Ubuntu, Debian, and LinuxMint operating systems. You can visit here to read more about Python releases.
Step 1 – Installing Prerequisite
As you are going to install Python 3.8 from the source. You need to install some development libraries to compile Python source code. Use the following command to install prerequisites for Python:
sudo apt-get 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
Step 2 – Download Python 3.8
Download Python source code using the following command from python official site. You can also download the latest version in place of the specified below.
cd /opt sudo wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz
Then extract the downloaded source archive file
sudo tar xzf Python-3.8.12.tgz
Step 3 – Compile Python Source
Use the below set of commands to compile Python source code on your system using the altinstall command.
cd Python-3.8.12 sudo ./configure --enable-optimizations sudo make altinstall
Step 4 – Check Python Version
Check the installed version of python using the following command. As you have not overwritten the default Python version on the system, So you have to use Python 3.8 as follows:
python3.8 -V Python-3.8.12
After successful installation remove the downloaded archive to save disk space
cd /opt sudo rm -f Python-3.8.12.tgz
Conclusion
This tutorial helped you for installing Python 3.8 on Ubuntu, Debian, and Linux Mint systems by compiling it from source code.
56 Comments
Thank you so much. I spend two days in these and final I got solution on your blog
Thank you so much.
the compilation is taking hours
Instructions followed and everything seems to have worked.
Noted that the install is in /opt –> is this how it’s supposed to be? Not /usr/bin?
Worked well for me, thanks
Thanks a lot Rahul and really appreciate it: Excellent article. I followed your instructions under my Linux Mint Debian based and worked like hell…
Happy Ramadan…
Mohee from Doha
You suggest installing checkinstall – then never use it. The following method, making use of checkinstall makes it far easier to update, or uninstall the Python version in the future.
Also, you need the liblzma-dev dependency.
Dependencies
sudo apt-get 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 liblzma-dev
Download Tar and extract
cd /opt
sudo wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
sudo tar xzf Python-3.8.6.tgz
Compile and Install
cd Python-3.9.1
sudo ./configure –enable-optimizations
make -n altinstall > altinstall_script.sh
chmod +x altinstall_script.sh
sudo checkinstall ./altinstall_script.sh
You instruct to install checkinstall. Then don’t use it.
See https://forums.linuxmint.com/viewtopic.php?f=47&t=329412&p=1878942#p1878942
king
Thanks a lot!!
Hi Rahul
Thanks a lot. Before I wasted many hours of trying to install python3.8. On my Linuxcomputer there was python3.5.2 but programming with it doesn’t functioning fine.
With this instructions it was no problem to get python3.8, I am happy.
Many thanks and stay healthy.
Michael
did as written, everything works
wow, it works perfectly, thanks a lot.
Thank you you much for this info <3
Thank you very much
Thank you very much, this help me a lot.
Thank you very much 🙂
thanks
Thanks a lot!
Thanks!
Thanks for your clean instructions.
Thank you very match!
Suppose that now I want to uninstall this version of python, how I can proceed?
Hello, and thank you for this important information. I have successfully installed Python 3.8 in Ubuntu three times now. Yet, every time I open my IDE (Spyder), Python 2.7 is running. When I write python in the Ubuntu terminal it shows python 2.7. When I write python 3.8 in the terminal, I get “python: can’t open file ‘3.8’ : [Errno 2] No such file or directory” Can you help? Thanks
Use python3 to run commands, not python.
Sorry about my previous comment, I didn’t read the article. You should type python3.8 without a space.
I hope that helps.
very good,tanx
Great article from Rahul. Worked perfectly. Installed on Ubuntu 16.04 and WSL (1803 build 17134.1304).
Allowed me to develop for Alpine 3.11.3 docker container which uses python 3.8.1
Hallo Rahul,
thank you for your great description.
It worked proper on my raspberry pi and in a virtual machine with ubuntu18.04.
Did not work for me. I copied, pasted and executed every command line RAHUL listed for the install, with no errors returned. Type in python3.8 -V as directed yields -bash: python3.8: command not found. Type in python3 -V and Python 3.5.3 is returned. Any other way to verify that the install was successful, or how to correct?
Did you check your $PATH ?
works great with wsl and updated version of python 3.8.1. Nice work.
Didn’t work for me. Looking in config.log, there’s
configure:3870: $? = 0
configure:3859: gcc -V >&5
gcc: error: unrecognized command line option ‘-V’
gcc: fatal error: no input files
compilation terminated.
Thank you very much, I use all instructions and it run perfectly.
I’ve installed and using it, but 3.8 doesn’t appear when I use “ls -ls /usr/bin/python*”, only the versions I had previously. Where it was installed?
I have installed this and it works very well. However, I want know how to uninstall this version of python as a Just In Case.
works in linuxmint terminal window
Laura,
You might have just typed in Python3 instead of Python3.8. Just my guess.
The reason it pulled up Python3.7.3 instead of Python3.8 is that you may have not told it you wanted Python3.8
The default python binary file is usr/bin/python if you had followed Rahul’s instructions as posted above.
This may not have answered your question fully but at least it will help point you in the right direction.
P.s. sorry I did not realize I did not hit the Reply to Laura in my last comment.
Laura,
You might have just typed in Python3 instead of Python3.8. Just my guess.
The reason it pulled up Python3.7.3 instead of Python3.8 is that you may have not told it you wanted Python3.8
The default python binary file is usr/bin/python if you had followed Rahul’s instructions as posted above.
This may not have answered your question fully but at least it will help point you in the right direction.
Hi, thank you very much for this information.
I have a question: where is the file with python3.8.0?
in “ls -l / usr / bin / python *”
Does not appear
Thank you Rahul,
now, I want you to suggest what next steps come first, I want to work with spyder:
Must I create a virtual env for python 3.8 first and then install and declare such env inside spyder? or can I use the python default version of my system to install spyder and then declare only the path to python 3.8?
For the Application-specific Python version, I suggest using virtualenv.
Does not work, when starting my IDLE, I’m still on the 3.7.3 version….
What should I do ?
Thanks a lot pal. Recently I switched Linux family – Ubuntu and was struggling to install Python 3.8. Your post helped.
Thank you! Which is the installation directory of Python 3.8, is it under the directory /opt/python3.8/?
This worked. Thanks a lot.
Thank you… Helped me a lot!
just one more thing… for noobs like me 🙂
do a
$ cd ..
before
$ sudo rm -f Python-3.8.0.tgz
because we’re still at the Python-3.8.0 folder
then
$ ls
to see if folder still exist
Thank a ton, Rahul
Thanks, Terry for your suggestion.
My name’s Angelson Herinjaka from Madagascar Island, am very grateful for your kind assistance my brother, may God bless you every single day.
It works
Yes it does.
Thank you!
Hello
Sorry, should have mentioned that the normal installers usually include sqlite. It’s included for e.g. REPL/ ipython history etc. I’ve compiled and installed Python a few times but still a bit fuzzy on installation.
Does this give you sqlite in the install?