I try to install python 3.4.3 in my Debian stretch. I followed these steps:

cd /opt/
wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz
cd Python-3.4.3

I encountered this error message while compiling:

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.

Failed to build these modules:
_hashlib              _ssl                                     

running build_scripts
creating build/scripts-3.4
copying and adjusting /opt/Python-3.4.3/Tools/scripts/pydoc3 -> build/scripts-3.4
copying and adjusting /opt/Python-3.4.3/Tools/scripts/idle3 -> build/scripts-3.4
copying and adjusting /opt/Python-3.4.3/Tools/scripts/2to3 -> build/scripts-3.4
copying and adjusting /opt/Python-3.4.3/Tools/scripts/pyvenv -> build/scripts-3.4
changing mode of build/scripts-3.4/pydoc3 from 644 to 755
changing mode of build/scripts-3.4/idle3 from 644 to 755
changing mode of build/scripts-3.4/2to3 from 644 to 755
changing mode of build/scripts-3.4/pyvenv from 644 to 755
renaming build/scripts-3.4/pydoc3 to build/scripts-3.4/pydoc3.4
renaming build/scripts-3.4/idle3 to build/scripts-3.4/idle3.4
renaming build/scripts-3.4/2to3 to build/scripts-3.4/2to3-3.4
renaming build/scripts-3.4/pyvenv to build/scripts-3.4/pyvenv-3.4
/usr/bin/install -c -m 644 ./Tools/gdb/libpython.py python-gdb.py
gcc -pthread -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes    -Werror=declaration-after-statement   -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Modules/_testembed.o ./Modules/_testembed.c
gcc -pthread   -Xlinker -export-dynamic -o Modules/_testembed Modules/_testembed.o libpython3.4m.a -lpthread -ldl  -lutil   -lm  
# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
sed -e "s,@EXENAME@,/usr/local/bin/python3.4m," < ./Misc/python-config.in >python-config.py
# Replace makefile compat. variable references with shell script compat. ones;  -> 
sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
# On Darwin, always use the python version of the script, the shell
# version doesn't use the compiler customizations that are provided
# in python (_osx_support.py).
if test `uname -s` = Darwin; then \
    cp python-config.py python-config; \

What should I do to overcome this?

  • Is there some reason why you need python 3.4 rather than 3.5? apt-get install python3 will install python 3.5 in stretch. – cas Jul 25 '17 at 6:07
  • most of the libraries of my project depends on 3.4.3 – Sathish Kumar Jul 25 '17 at 6:09
  • you need to install the -dev versions of the libraries that python wants. e.g. libssl-dev, libgdbm-dev, lzma-dev. The -dev packages include the header files and .a library needed for compiling software that uses these libraries. – cas Jul 25 '17 at 6:20
  • altternatively (and preferably) update your project so that it works with the python 3.5 compatible versions of those libraries. – cas Jul 25 '17 at 6:21
  • Same error exists after install all dev packages – Sathish Kumar Jul 25 '17 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.