'How to install python3.6 on Ubuntu 22.04

I need to install this specific python version, to prepare a developer environment, because I'm maintaining a system with multiple libraries based on python 3.6.9. I recently installed Ubuntu 22.04 on my laptop, but I had no success trying to install this python version.

I tried to install with apt-get after adding the deadsneak repository, but this python version is not available.

I tried installing from source by compiling, but it did not work. Running sudo make altinstall exited with this error:

Segmentation fault (core dumped)
make: *** [Makefile:1112: altinstall] Erro 139


Solution 1:[1]

Although the original question and the above answer was initially useful to me, I have to say that since python 3.6 is no longer maintained since the end of 2021, I finally had to switch to a more recent version because pipenv could detect the manually compiled python 3.6 but locking consistently failed.

Solution 2:[2]

You manage this input by separating the element with "," using split().

l = ["Foo 6, Bar 9, Ding 8, Dong 7"]

new_list = [ele.strip() for ele in l[0].split(",")]

Output:

['Foo 6', 'Bar 9', 'Ding 8', 'Dong 7']

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 peschü
Solution 2