Python 3.7 on Debian Stretch

To install the latest python on Debian (python 3.7 in this case) we need to go through a few steps.
First install some dependencies.

sudo apt-get install -y libffi-dev libbz2-dev liblzma-dev libsqlite3-dev libncurses5-dev libgdbm-dev zlib1g-dev libreadline-dev libssl-dev tk-dev build-essential libncursesw5-dev libc6-dev openssl git

Next download python 3.7 and extract it.

tar xvf Python-3.7.0.tar.xz
cd Python-3.7.0

Configure, make and make install

./configure --enable-optimizations --with-ensurepip=install
make -j8
sudo make altinstall

Update your update-alternatives
Use whereis python to find the location of your binaries

update-alternatives --install /usr/bin/python python /usr/local/bin/python3.7 50
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 40
update-alternatives --install /usr/bin/python python /usr/bin/python3.5 30

image is the logo of


Leave a Reply

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.