Created:        2023-02-28 Tue
Last modified:  2023-02-28 Tue

Installation: Python 3.6 on Ubuntu 22.04

Warning

Python 3.6 reached end-of-life at 2021-12-23

Final release for 3.6 series [1]

$ wget https://www.python.org/ftp/python/3.6.15/Python-3.6.15.tgz
$ tar -xf Python-3.6.15.tgz
$ cd Python-3.6.15
$ vim Modules/Setup.dist

Modules/Setup.dist modification [2]

< #SSL=/usr/local/ssl
< #_ssl _ssl.c \
< #     -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
< #     -L$(SSL)/lib -lssl -lcrypto
---
> SSL=/etc/ssl
> _ssl _ssl.c \
>       -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
>       -L$(SSL)/lib -lssl -lcrypto
$ sudo apt install libssl-dev
$ ./configure --enable-optimizations --prefix=$HOME/opt/py36
$ make altinstall
$ sudo apt purge libssl-dev

Warning

Segmentation fault can occur while building/running. Root cause wasn't investigated.

In my case pip3.6 -help always fails, but python3.6 -m pip -help works.

pip reinstallation (can be useful).

$ python3.6 -m pip uninstall pip
$ python3.6 -m ensurepip

References