How to Install an Old Version of Python on Debian or Ubuntu

Content

Install Necessary Libs

Update your package manager and install required packages to build python.

$ sudo apt-get update
$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
    libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
    libncurses5-dev libncursesw5-dev xz-utils tk-dev libgdbm-dev \
    libc6-dev

Download Python Source Tarball

Say you want to install python 3.7.3, download the source tarball (note that the link is case sensitive).

$ wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz

Feel free to browse https://www.python.org/ftp/python/ for other versions.

Build and Install

After downloaded, unzip it and enter the source directory.

$ tar -zx -f Python-3.7.3.tgz
$ cd Python-3.7.3

Then start building.

$ ./configure
$ make
$ sudo make install
GitHub | Email me