Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at: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

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

    Advertisement

    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

    Related Posts

    How to Install Python 3.11 on Amazon Linux 2

    Installing Python 3.11 on Debian Linux

    How To Install Python 3.11 on Debian 11/10

    Installing Python 3.11 on Ubuntu, Debian and LinuxMint

    How To Install Python 3.11 on Ubuntu, Debian and LinuxMint

    View 56 Comments

    56 Comments

    1. Sumit Gutpa on July 27, 2022 10:54 am

      Thank you so much. I spend two days in these and final I got solution on your blog

      Reply
    2. jithesh on January 20, 2022 9:23 pm

      Thank you so much.

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

      the compilation is taking hours

      Reply
    4. 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
    5. Kiran on August 18, 2021 10:58 am

      Worked well for me, thanks

      Reply
    6. 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
    7. 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
    8. 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
    9. lucas on December 19, 2020 2:55 pm

      king

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

      Thanks a lot!!

      Reply
    11. 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
    12. flyuia on November 15, 2020 5:16 pm

      did as written, everything works

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

      wow, it works perfectly, thanks a lot.

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

      Thank you you much for this info <3

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

      Thank you very much

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

      Thank you very much, this help me a lot.

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

      Thank you very much 🙂

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

      thanks

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

      Thanks a lot!

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

      Thanks!

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

      Thanks for your clean instructions.

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

      Thank you very match!

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

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

      Reply
    24. 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
    25. Ali on February 20, 2020 4:54 am

      very good,tanx

      Reply
    26. 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
    27. 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
    28. 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
    29. netbob on February 13, 2020 5:38 am

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

      Reply
    30. 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
    31. anon on December 22, 2019 9:14 am

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

      Reply
    32. 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
    33. 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
    34. anon on November 11, 2019 2:25 am

      works in linuxmint terminal window

      Reply
    35. 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
    36. 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
    37. 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
    38. 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
    39. 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
    40. 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
    41. 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
    42. Jere on October 23, 2019 12:10 pm

      This worked. Thanks a lot.

      Reply
    43. 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
    44. sazima on October 20, 2019 10:17 am

      It works

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

      Yes it does.

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

      Thank you!

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

      Hello

      Reply
    48. 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
    49. Michael Amy on October 15, 2019 3:00 pm

      Does this give you sqlite in the install?

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Error: EACCES: permission denied, scandir (Resolved)
    • How To Install Python 3.11 on Ubuntu 22.04 / 20.04
    • How to Install Python 3.11 on Amazon Linux 2
    • An Introduction to the “./configure” Command: Compiling Source Code in Linux
    • How to Install PHP 8.x on Pop!_OS
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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