How to Install Latest Python 3.6 Version in Linux

Several top universities around the globe use Python to introduce students to programming. The Massachusetts Institute of Technology (MIT), the University of Texas at Arlington, and Stanford are only a few examples of institutions that use this language extensively.

Additionally, it is important to note that Python is also useful for a wide variety of educational, enterprise, and scientific purposes – from web development to desktop applications to machine learning and everything in between.

Read Also: How to Install Python 3.6 in Ubuntu

Currently, there are two major Python versions in use – 2 and 3, with 2 rapidly losing grounds to 3 since the former is no longer under active development. Since all Linux distributions come with Python 2.x installed.

Suggested Read: Getting Started with Python Programming and Scripting in Linux – Part 1

In this article we will show how to install and use Python 3.x in CentOS/RHEL 7, Debian and its derivatives such as Ubuntu (latest LTS version already has latest Python installed) or Linux Mint. Our focus will be installing the core language tools that can be used in the command line.

However, we will also explain how to install the Python IDLE – a GUI-based tool that allows us to run Python code and create standalone functions.

Install Python 3.6 in Linux

At the time of this writing (October 2017), the latest Python 3.x versions available in CentOS/RHEL 7 and Debian 8/9 are 3.4 and 3.5 respectively.

Although we can install the core packages and their dependencies using yum and aptitude (or apt-get), we will explain how to perform the installation from source instead.

Why? The reason is simple: this allows us to have the latest stable release of the language (3.6) and to provide a distribution-agnostic installation method.

Prior to installing Python in CentOS 7, let’s make sure our system has all the necessary development dependencies:

# yum -y groupinstall development
# yum -y install zlib-devel

In Debian we will need to install gcc, make, and the zlib compression / decompression library:

# aptitude -y install gcc make zlib1g-dev

To install Python 3.6, run the following commands:

# wget
# tar xJf Python-3.6.3.tar.xz
# cd Python-3.6.3
# ./configure
# make
# make install

Now relax and go grab a sandwich because this may take a while. When the installation is complete, use which to verify the location of the main binary:

# which python3
# python3 -V

The output of the above command should be similar to:

Check Python Version in Linux

Check Python Version in Linux

To exit the Python prompt, simply type.


and press Enter.

Congratulations! Python 3.6 is now installed on your system.

Install Python IDLE in Linux

Python IDLE is a GUI-based tool for Python. If you wish to install the Python IDLE, grab the package named idle (Debian) or python-tools (CentOS).

# apt-get install idle       [On Debian]
# yum install python-tools   [On CentOS]

Type the following command to start the Python IDLE.

# idle

In this article we have explained how to install the latest Python stable version from source.

Last, but not least, if you’re coming from Python 2, you may want to take a look at the 2to3 official documentation. This is a program that reads Python 2 code and transforms it into valid Python 3 code.

Do you have any questions or comments about this article? Feel free to get in touch with us using the form below.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Gabriel Cánepa

Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

15 Responses

  1. relative says:

    You can rest assured that when you say “You can rest assured” in the future it will not work as you expect it to due mostly to bad assumptions such as in this case (not that it matters but using a headless latest generic installed openmediavault) we need to change the basic commands for the shell version apt/apt-get as assuming there’s a GUI application installed aptitude/yum etc will stop the beginner in their tracks as per all current so called developers not being end user/home user friendly etc…

    so anyway,

    apt -y groupinstall development
    apt -y install zlib-devel

    In Debian we will need to install gcc, make, and the zlib compression / decompression library:

    apt-get  -y install gcc make zlib1g-dev

    To install Python 3.6, run the following commands:

    tar xJf Python-3.6.3.tar.xz
    cd Python-3.6.3
    make -j4
    make install

    Now relax and go grab a sandwich because this may take a while. When the installation is complete, use which to verify the location of the main binary:

    # which python3
    # python3 -V






    python3 -V
    Python 3.5.3


    [email protected]:~/Python-3.6.3# python3 -V
    Python 3.5.3
  2. Priyanshu Kumar says:

    Such a great tutorial, thanks

  3. Sixpack Kid says:

    On OpenSUSE, you might need to install readline package as well.

    $ sudo zypper install zlib-devel
    $ sudo zypper install readline-devel
    $ ./configure --enable-optimizations
    $ make
    $ sudo make install
  4. Pawan Dubey says:

    We finished our work but still, the installation is in progress. What shall I do ??

  5. Alex W. says:

    Mr. Cánepa, thanks for the method which you wrote and that worked perfectly for me.

    Now I have a related and urgent question for you, please.

    After I played with the Python 3.6 interpreter on command line, I think that my Linux Mint 17 does NOT support it very well for convenient use in the terminal.

    So I want to reverse to the system default Python 3.4 . Do you have some idea about how I should do it safely? I’ve googled about that and found no answer.

    Thank you very much.

  6. Apurba Nath says:


    After downloading python, when I use this command (./configure), it shows below error.

    configure: error: in /root/Python-3.6.3 :
    configure: error: no acceptable C compiler found in $PATH
    see `config.log` for more details

    Can you please tell me next what should I do?

    • Ravi Saive says:


      Install C Compiler (GCC) using the following command as per your Linux distribution (run as root).

      # yum groupinstall "Development tools"  [On RedHat based]
      # apt-get install build-essential       [On Debian based]
  7. rogerio says:

    can you help me?

    [email protected]:/home/rogerio/Área de trabalho/Python-3.6.0# make install
    if test “no-framework” = “no-framework” ; then \
    /usr/bin/install -c python /usr/local/bin/python3.6m; \
    else \
    /usr/bin/install -c -s Mac/pythonw /usr/local/bin/python3.6m; \
    if test “3.6” != “3.6m”; then \
    if test -f /usr/local/bin/python3.6 -o -h /usr/local/bin/python3.6; \
    then rm -f /usr/local/bin/python3.6; \
    fi; \
    (cd /usr/local/bin; ln python3.6m python3.6); \
    if test -f libpython3.6m.a && test “no-framework” = “no-framework” ; then \
    if test -n “” ; then \
    /usr/bin/install -c -m 555 /usr/local/bin; \
    else \
    /usr/bin/install -c -m 555 libpython3.6m.a /usr/local/lib/libpython3.6m.a; \
    if test libpython3.6m.a != libpython3.6m.a; then \
    (cd /usr/local/lib; ln -sf libpython3.6m.a libpython3.6m.a) \
    fi \
    fi; \
    if test -n “”; then \
    /usr/bin/install -c -m 555 /usr/local/lib/; \
    fi; \
    else true; \
    if test “x” != “x” ; then \
    rm -f /usr/local/binpython3.6-32; \
    lipo \
    -output /usr/local/bin/python3.6-32 \
    /usr/local/bin/python3.6; \
    running build
    running build_ext
    INFO: Can’t locate Tcl/Tk libs and/or headers
    warning: building with the bundled copy of libffi is deprecated on this platform. It will not be distributed with Python 3.7
    checking build system type… x86_64-unknown-linux-gnu
    checking host system type… x86_64-unknown-linux-gnu
    checking target system type… x86_64-unknown-linux-gnu
    /home/rogerio/Área de trabalho/Python-3.6.0/Modules/_ctypes/libffi/configure: line 2868: cd: too many arguments
    checking for gsed… sed
    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… configure: error: unsafe srcdir value: ‘/home/rogerio/Área de trabalho/Python-3.6.0/Modules/_ctypes/libffi’
    Failed to configure _ctypes module
    *** WARNING: renaming “_ctypes” since importing it failed: build/lib.linux-x86_64-3.6/ cannot open shared object file: No such file or directory
    error: [Errno 2] No such file or directory: ‘build/lib.linux-x86_64-3.6/’ -> ‘build/lib.linux-x86_64-3.6/’
    Makefile:617: recipe for target ‘sharedmods’ failed
    make: *** [sharedmods] Error 1
    [email protected]:/home/rogerio/Área de trabalho/Python-3.6.0#

    • Ravi Saive says:


      Have you installed necessary development dependencies on the system? If not, please install it as shown in the article, before installing Python from sources..

  8. bulongo says:

    how do i uninstall python3.5.2

  9. Diane says:

    I thought that installing 3.6 on Linux without care can wreck your system, my understanding is that Linux uses 2.x for yum. Is this true? Do you have to install it separately from 2.x? If so, how do you do that? Sorry, I’m new to this..

    • Gabriel A. Cánepa says:


      You can rest assured that you won’t wreck your system by following the steps outlined in this article :). And by the way, Python3.x and Python2.x can coexist in the same problem without issues. However, problems may arise if you try to change the symbolic links that point to the binaries — python points to python version 2 whereas python3 points to version 3. Hope this helps.

  10. Guilherme Melo says:


    An easy way to get precompiled packages is with conda package manager. You can install miniconda:
    And then create a python 3.6 env in a virtualenv-style:

    conda create -n mypy36_env python=3.6
    source activate mypy36_env

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.