Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Segmentation fault during installation of Python 3.6 on Debian 8

I am trying to install Python 3.6 on Debain 8. When I run the make command, an error occurs.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.11 (jessie)
Release:    8.11
Codename:   jessie

The commands I run:

wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
tar xvf Python-3.6.3.tgz
cd Python-3.6.3
./configure --enable-optimizations
make -j8  # Error occurs here
sudo make altinstall
python3.6

That's the error

...
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_dbm                  _gdbm                 _lzma              
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
atexit                pwd                   time               
running build_scripts
copying and adjusting /home/lucas/Python-3.6.3/Tools/scripts/pydoc3 -> build/scripts-3.6
copying and adjusting /home/lucas/Python-3.6.3/Tools/scripts/idle3 -> build/scripts-3.6
copying and adjusting /home/lucas/Python-3.6.3/Tools/scripts/2to3 -> build/scripts-3.6
copying and adjusting /home/lucas/Python-3.6.3/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:586: recipe for target 'sharedmods' failed
make[2]: *** [sharedmods] Error 139
make[2]: Leaving directory '/home/lucas/Python-3.6.3'
Makefile:479: recipe for target 'build_all_generate_profile' failed
make[1]: *** [build_all_generate_profile] Error 2
make[1]: Leaving directory '/home/lucas/Python-3.6.3'
Makefile:460: recipe for target 'profile-opt' failed
make: *** [profile-opt] Error 2
like image 461
Developer Avatar asked Sep 28 '18 20:09

Developer


1 Answers

Warning:

If you try this because of a failed installation, delete as much as you can of the failed install because it is not a good idea to leave broken installs on your computer (it tends to break re-installs) try:

rm -rfv <broken_python_version>
locate <broken_python_version>
rm -rfv `locate <broken_python_install>`

Instructions

Try installing these modules with apt first by using

sudo apt update 
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev tk-dev liblzma-dev lzma

Then download python using wget:

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

or just download the latest version from the python official website. To build python, enter:

tar -xf Python-3.6.3.tgz && rm Python-3.6.3.tgz # or your python version
cd Python-3.6.3 # or your python version
./configure --enable-optimizations
make -j `nproc` # optimized for the number of processors on your computer
sudo make altinstall

To test if the python installation works try:

python3 --version # python3 can be replaced with python3.8 depending on your python version
like image 197
tominekan Avatar answered Sep 22 '22 10:09

tominekan