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 3 Answers
I have faced the same problems and could make it work by adding some additional flags when running ./configure
Here are my steps:
Step 1 – Prerequsities
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 libffi-dev liblzma-dev \
libgdbm-dev libnss3-dev libedit-dev libc6-devStep 2 – Download Python 3.6
wget
tar -xzf Python-3.6.15.tgzStep 3 – Compile Python Source
cd Python-3.6.15
./configure --enable-optimizations -with-lto --with-pydebug
make -j 8 # adjust for number of your CPU cores
sudo make altinstallStep 4 – Check the Python Version
python3.6 -V 10 If you need it to install with pyenv, you could try this one:
$ sudo apt install clang -y
$ CC=clang pyenv install 3.6.9 0 As on Aug 2nd 2023, if anyone is still stuck with Segmentation fault (core dumped) issue. Here's the solution that worked for me. Thanks to Issue45700 - .
Ubuntu 22.04 comes with gcc 11. So let us install gcc-10 and compile Python with it.
Below are the steps to incorporate Workaround1 mentioned in Issue45700 -
apt-get install gcc-10 -y
< Download and extract python >
CC="gcc-10" ./configure
< Install python using make >You can use additional flags mentioned in
1