How to Install Python 3.7 on Debian 9

Python is one of the most popular programming languages in the world. With its simple and easy to learn syntax Python is a great choice for beginners and experienced developers. Python is quite a versatile programming language, you can use it to do almost anything you want, write small scripts, build games, develop websites, create machine learning algorithms, analyze data and more. Python is also portable which means you can run the same Python script on different operating systems without any changes.

Python 2 support ends in 2020. Python 3 is the present and future of the language.

Python 3.7 is the latest major release of the Python language, and it includes many new features such as postponed evaluation of type annotations, support for data classes and context variables, customization of access to module attributes, and more .

This tutorial covers how to install Python 3.7 on Debian 9.

Installing Python 3.7 on Debian

Building Python 3.7 on Debian is a relatively straightforward process and will only take a few minutes. 

  • Start by installing the packages necessary to build Python source:

    sudo apt updatesudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl libbz2-dev
  • Download the latest release’s source code from the Python download page using the following curl command :

    curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz

    At the time of writing this article, the latest release is 3.7.3.

  • When download is complete, extract the tarball :

    tar -xf Python-3.7.3.tar.xz
  • Navigate to the Python source directory and run the configure script that will perform a number of checks to make sure all of the dependencies on your system are present:

    cd Python-3.7.3
    ./configure --enable-optimizations

    The --enable-optimizations option will optimize the Python binary by running multiple tests which will make the build process slower.

  • Run make to start the build process:

    make -j 8

    For faster build time, modify the -j flag according to your processor. If you do not know the number of cores your processor you can find it by typing nproc. My system has 8 cores, so I am using the -j8 flag.

  • Once the build is done install the Python binaries by running the following command as a user with sudo access :

    sudo make altinstall

    Do not use the standard make install as it will overwrite the default system python3 binary.

  • At this point, Python 3.7 is installed on your Debian system and ready to be used. You can verify it by typing:

    python3.7 --version
    Python 3.7.3

You have installed Python 3.7 on your Debian 9 machine. You can start installing third-party modules with Pip and developing your Python 3 project.


  • Python 3.7, install python, Debian 9
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to Set Up a Mac for Your Kids

Providing children with access to a computer and the internet is increasingly important, but so...

How to Get Help With a Command from the Linux Terminal

Whether you’re an inexperienced terminal user or a grizzled veteran, you won’t always know the...

How to change the ssh port on Linux

To Change the SSH Port for Linux Server Connect to your server via SSH Switch to the root...

How To Install screenFetch in Linux

If you've browsed Linux groups on social media, you've probably seen a lot of screenshots that...

Static IP vs. Dynamic IP Address

A static IP address is one that remains fixed and never changes. The PC always sees the same...

Powered by WHMCompleteSolution