Python fails to compile on Raspberry Pi

Viewed 372

I am trying to compile Python 3.6 on Raspberry Pi Jessie following the instructions here and I am getting the following error:

running build_scripts
creating build/scripts-3.6
copying and adjusting /home/pi/Downloads/Python-3.6.12/Tools/scripts/pydoc3 -> build/scripts-3.6
copying and adjusting /home/pi/Downloads/Python-3.6.12/Tools/scripts/idle3 -> build/scripts-3.6
copying and adjusting /home/pi/Downloads/Python-3.6.12/Tools/scripts/2to3 -> build/scripts-3.6
copying and adjusting /home/pi/Downloads/Python-3.6.12/Tools/scripts/pyvenv -> build/scripts-3.6
changing mode of build/scripts-3.6/pydoc3 from 644 to 755
changing mode of build/scripts-3.6/idle3 from 644 to 755
changing mode of build/scripts-3.6/2to3 from 644 to 755
changing mode of build/scripts-3.6/pyvenv from 644 to 755
renaming build/scripts-3.6/pydoc3 to build/scripts-3.6/pydoc3.6
renaming build/scripts-3.6/idle3 to build/scripts-3.6/idle3.6
renaming build/scripts-3.6/2to3 to build/scripts-3.6/2to3-3.6
renaming build/scripts-3.6/pyvenv to build/scripts-3.6/pyvenv-3.6
Segmentation fault
Makefile:603: recipe for target 'sharedmods' failed
make[2]: *** [sharedmods] Error 139
make[2]: Leaving directory '/home/pi/Downloads/Python-3.6.12'
Makefile:496: recipe for target 'build_all_generate_profile' failed
make[1]: *** [build_all_generate_profile] Error 2
make[1]: Leaving directory '/home/pi/Downloads/Python-3.6.12'
Makefile:477: recipe for target 'profile-opt' failed
make: *** [profile-opt] Error 2

I am getting the same errors when trying to compile any 3.6.x or 3.8.x Python version.

Any idea what the problem could be?

2 Answers

To build python from source you need the development packages needed to install python.

This is how to install them:

$ sudo apt update

$ sudo apt install build-essential zlib1g-dev \ libncurses5-dev libgdbm-dev libnss3-dev \ libssl-dev libreadline-dev libffi-dev curl

Then follow the rest of the instructions given to you.

When you trying to compile Python on Debian 8 you have to follow instructions exactly. For some reason if you running 'make -j 2' you would get this errors but while you running just 'make' it compiling as intended

Related