• Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install Python 3.8 on Ubuntu, Debian and LinuxMint

Written by Rahul, Updated on January 19, 2021

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.7 on Ubuntu, Debian, and LinuxMint operating system. You can visit here to read more about Python releases.

Step 1 – 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 specified below.

cd /opt
sudo wget https://www.python.org/ftp/python/3.8.7/Python-3.8.7.tgz

Then extract the downloaded source archive file

sudo tar xzf Python-3.8.7.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.7
sudo ./configure --enable-optimizations
sudo make altinstall
make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

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.7

After successful installation remove the downloaded archive to save disk space

cd /opt
sudo rm -f Python-3.8.7.tgz

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

50 Comments

  1. Avatar Bob Reply
    January 15, 2021 at 9:52 pm

    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

  2. Avatar Bob Reply
    January 13, 2021 at 8:03 pm

    You instruct to install checkinstall. Then don’t use it.

    See https://forums.linuxmint.com/viewtopic.php?f=47&t=329412&p=1878942#p1878942

  3. Avatar lucas Reply
    December 19, 2020 at 2:55 pm

    king

  4. Avatar Ambrose Reply
    November 24, 2020 at 10:02 am

    Thanks a lot!!

  5. Avatar James Bond Reply
    November 23, 2020 at 8:46 pm

    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

  6. Avatar flyuia Reply
    November 15, 2020 at 5:16 pm

    did as written, everything works

  7. Avatar Tejas Chaudhari Reply
    October 3, 2020 at 1:23 pm

    wow, it works perfectly, thanks a lot.

  8. Avatar Nelmie Reply
    September 7, 2020 at 6:24 am

    Thank you you much for this info <3

  9. Avatar Kevin Cojean Reply
    July 21, 2020 at 12:05 pm

    Thank you very much

  10. Avatar Kelvin Reply
    July 8, 2020 at 3:18 pm

    Thank you very much, this help me a lot.

  11. Avatar mohsen Reply
    July 8, 2020 at 11:04 am

    Thank you very much 🙂

  12. Avatar otp Reply
    July 5, 2020 at 9:42 pm

    thanks

  13. Avatar Pedro Riva Reply
    June 20, 2020 at 7:39 am

    Thanks a lot!

  14. Avatar Not Rahul Kumar Reply
    June 3, 2020 at 2:02 am

    Thanks!

  15. Avatar Ozgur Reply
    June 2, 2020 at 7:16 pm

    Thanks for your clean instructions.

  16. Avatar Rogério Barreto Reply
    March 17, 2020 at 4:28 am

    Thank you very match!

  17. Avatar Masacroso Reply
    March 11, 2020 at 9:22 pm

    Suppose that now I want to uninstall this version of python, how I can proceed?

  18. Avatar John Reply
    February 24, 2020 at 2:31 am

    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

    • Avatar Evan Reply
      May 1, 2020 at 4:37 am

      Use python3 to run commands, not python.

    • Avatar Evan Reply
      May 1, 2020 at 4:43 am

      Sorry about my previous comment, I didn’t read the article. You should type python3.8 without a space.

    • Avatar Evan Reply
      May 1, 2020 at 4:44 am

      I hope that helps.

  19. Avatar Ali Reply
    February 20, 2020 at 4:54 am

    very good,tanx

  20. Avatar Mike King Reply
    February 18, 2020 at 5:30 pm

    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

  21. Avatar Andreas Reply
    February 16, 2020 at 3:55 pm

    Hallo Rahul,
    thank you for your great description.
    It worked proper on my raspberry pi and in a virtual machine with ubuntu18.04.

  22. Avatar Jim Reply
    February 14, 2020 at 3:34 am

    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?

    • Avatar Gustavo Pinsard Reply
      February 16, 2020 at 8:23 pm

      Did you check your $PATH ?

  23. Avatar netbob Reply
    February 13, 2020 at 5:38 am

    works great with wsl and updated version of python 3.8.1. Nice work.

  24. Avatar Rolf Reply
    January 3, 2020 at 10:24 am

    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.

  25. Avatar anon Reply
    December 22, 2019 at 9:14 am

    Thank you very much, I use all instructions and it run perfectly.

  26. Avatar Marcelo Reply
    December 12, 2019 at 2:48 pm

    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?

  27. Avatar Vye Reply
    November 24, 2019 at 12:12 am

    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.

  28. Avatar anon Reply
    November 11, 2019 at 2:25 am

    works in linuxmint terminal window

  29. Avatar TechRancher Reply
    November 4, 2019 at 7:42 pm

    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.

  30. Avatar TechRancher Reply
    November 4, 2019 at 7:40 pm

    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.

  31. Avatar anbreaker Reply
    November 3, 2019 at 3:41 pm

    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

  32. Avatar Carlos Rodriguez-Contreras Reply
    October 29, 2019 at 8:41 pm

    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?

    • Rahul Rahul Reply
      October 30, 2019 at 7:54 am

      For the Application-specific Python version, I suggest using virtualenv.

  33. Avatar Laura Reply
    October 28, 2019 at 11:21 am

    Does not work, when starting my IDLE, I’m still on the 3.7.3 version….
    What should I do ?

  34. Avatar Mukunthan Reply
    October 27, 2019 at 1:13 pm

    Thanks a lot pal. Recently I switched Linux family – Ubuntu and was struggling to install Python 3.8. Your post helped.

  35. Avatar wu kt Reply
    October 24, 2019 at 3:39 am

    Thank you! Which is the installation directory of Python 3.8, is it under the directory /opt/python3.8/?

  36. Avatar Jere Reply
    October 23, 2019 at 12:10 pm

    This worked. Thanks a lot.

  37. Avatar terry Reply
    October 21, 2019 at 2:50 am

    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

    • Rahul Rahul Reply
      October 21, 2019 at 4:39 am

      Thanks, Terry for your suggestion.

      • Avatar Angelson Herinjaka Reply
        October 22, 2019 at 2:19 pm

        My name’s Angelson Herinjaka from Madagascar Island, am very grateful for your kind assistance my brother, may God bless you every single day.

  38. Avatar sazima Reply
    October 20, 2019 at 10:17 am

    It works

  39. Avatar pmus Reply
    October 18, 2019 at 8:26 am

    Yes it does.

  40. Avatar Jasmond Reply
    October 17, 2019 at 5:56 am

    Thank you!

  41. Avatar Tetea Reply
    October 16, 2019 at 8:15 am

    Hello

  42. Avatar Michael Amy Reply
    October 15, 2019 at 3:02 pm

    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.

  43. Avatar Michael Amy Reply
    October 15, 2019 at 3:00 pm

    Does this give you sqlite in the install?

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Debian 10
  • Download Ubuntu 20.04 LTS – DVD ISO Images
  • Linux Run Commands As Another User
  • How to Check PHP Version (Apache/Nginx/CLI)
  • How To Install and Configure GitLab on Ubuntu 20.04
  • How to Install PyCharm on Ubuntu 20.04
  • How to Check Ubuntu Version with Command or Script
  • How to Set all directories to 755 And all files to 644
© 2013-2021 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy