Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»Python»How to Install Python 3.8 on Ubuntu, Debian and LinuxMint

    How to Install Python 3.8 on Ubuntu, Debian and LinuxMint

    RahulBy RahulOctober 14, 20192 Mins ReadUpdated:September 1, 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.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
    
    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.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.

    Python Python3 Python3.8
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Convert String to Lowercase in Python
    Next Article How To Install MariaDB on Debian 10

    Related Posts

    How to Find Django Install Location in Linux

    Updated:April 27, 20221 Min Read

    How To Install Python 3.10 on Debian 11/10

    2 Mins Read

    How to Install Python 3.10 on CentOS/RHEL 8 & Fedora 35/34

    Updated:February 12, 20223 Mins Read

    How To Install Python 3.10 on Ubuntu, Debian & Linux Mint

    Updated:April 22, 20222 Mins Read

    How to Switch Python Version in Ubuntu & Debian

    Updated:April 22, 20223 Mins Read

    Working with Python Functions

    6 Mins Read

    55 Comments

    1. jithesh on January 20, 2022 9:23 pm

      Thank you so much.

      Reply
    2. Kingsley on November 4, 2021 5:03 am

      the compilation is taking hours

      Reply
    3. Dani on September 4, 2021 2:24 pm

      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?

      Reply
    4. Kiran on August 18, 2021 10:58 am

      Worked well for me, thanks

      Reply
    5. Mohee Jarada on April 25, 2021 9:53 pm

      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

      Reply
    6. Bob on January 15, 2021 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

      Reply
    7. Bob on January 13, 2021 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

      Reply
    8. lucas on December 19, 2020 2:55 pm

      king

      Reply
    9. Ambrose on November 24, 2020 10:02 am

      Thanks a lot!!

      Reply
    10. James Bond on November 23, 2020 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

      Reply
    11. flyuia on November 15, 2020 5:16 pm

      did as written, everything works

      Reply
    12. Tejas Chaudhari on October 3, 2020 1:23 pm

      wow, it works perfectly, thanks a lot.

      Reply
    13. Nelmie on September 7, 2020 6:24 am

      Thank you you much for this info <3

      Reply
    14. Kevin Cojean on July 21, 2020 12:05 pm

      Thank you very much

      Reply
    15. Kelvin on July 8, 2020 3:18 pm

      Thank you very much, this help me a lot.

      Reply
    16. mohsen on July 8, 2020 11:04 am

      Thank you very much 🙂

      Reply
    17. otp on July 5, 2020 9:42 pm

      thanks

      Reply
    18. Pedro Riva on June 20, 2020 7:39 am

      Thanks a lot!

      Reply
    19. Not Rahul Kumar on June 3, 2020 2:02 am

      Thanks!

      Reply
    20. Ozgur on June 2, 2020 7:16 pm

      Thanks for your clean instructions.

      Reply
    21. Rogério Barreto on March 17, 2020 4:28 am

      Thank you very match!

      Reply
    22. Masacroso on March 11, 2020 9:22 pm

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

      Reply
    23. John on February 24, 2020 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

      Reply
      • Evan on May 1, 2020 4:37 am

        Use python3 to run commands, not python.

        Reply
      • Evan on May 1, 2020 4:43 am

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

        Reply
      • Evan on May 1, 2020 4:44 am

        I hope that helps.

        Reply
    24. Ali on February 20, 2020 4:54 am

      very good,tanx

      Reply
    25. Mike King on February 18, 2020 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

      Reply
    26. Andreas on February 16, 2020 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.

      Reply
    27. Jim on February 14, 2020 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?

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

        Did you check your $PATH ?

        Reply
    28. netbob on February 13, 2020 5:38 am

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

      Reply
    29. Rolf on January 3, 2020 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.

      Reply
    30. anon on December 22, 2019 9:14 am

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

      Reply
    31. Marcelo on December 12, 2019 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?

      Reply
    32. Vye on November 24, 2019 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.

      Reply
    33. anon on November 11, 2019 2:25 am

      works in linuxmint terminal window

      Reply
    34. TechRancher on November 4, 2019 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.

      Reply
    35. TechRancher on November 4, 2019 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.

      Reply
    36. anbreaker on November 3, 2019 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

      Reply
    37. Carlos Rodriguez-Contreras on October 29, 2019 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?

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

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

        Reply
    38. Laura on October 28, 2019 11:21 am

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

      Reply
    39. Mukunthan on October 27, 2019 1:13 pm

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

      Reply
    40. wu kt on October 24, 2019 3:39 am

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

      Reply
    41. Jere on October 23, 2019 12:10 pm

      This worked. Thanks a lot.

      Reply
    42. terry on October 21, 2019 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

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

        Thanks, Terry for your suggestion.

        Reply
        • Angelson Herinjaka on October 22, 2019 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.

          Reply
    43. sazima on October 20, 2019 10:17 am

      It works

      Reply
    44. pmus on October 18, 2019 8:26 am

      Yes it does.

      Reply
    45. Jasmond on October 17, 2019 5:56 am

      Thank you!

      Reply
    46. Tetea on October 16, 2019 8:15 am

      Hello

      Reply
    47. Michael Amy on October 15, 2019 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.

      Reply
    48. Michael Amy on October 15, 2019 3:00 pm

      Does this give you sqlite in the install?

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Sublime Text 4 on Ubuntu 22.04
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.