I downloaded and compiled Python 3.7 from source on a Debian machine, however the 'readline' functionality (viewing line history, tab to autocomplete) is missing. I have the python3.5
package which was installed using apt
, and the functionality works there. I have the libreadline7
and readline-common
packages installed (these were installed before I compiled Python 3.7). I'm guessing there's a config file I need to edit / create somewhere, or maybe a flag I need to use during compilation? All the answers I could find lead to "install the readline
package" which was already the case for me.
Output of ./configure | grep "readline"
during Python compilation:
checking how to link readline libs... none
checking for rl_pre_input_hook in -lreadline... no
checking for rl_completion_display_matches_hook in -lreadline... no
checking for rl_resize_terminal in -lreadline... no
checking for rl_completion_matches in -lreadline... no
checking for append_history in -lreadline... no
You probably are missing libreadline-dev
which contains the actual header files that are needed to compile against the readline library.
If you sudo apt install libreadline-dev
and then recompile your python, you'll get readline support.
Answering your comment about what are header files: Header files are a component of C and C++ libraries. They declare which functions are available in a library. The standard Python implementation is written in C and thus uses these header files to declare the existence of these functions. By default configure
uses the presence of these headers files with matching function names to determine the presence of readline and other library functionality. Thus the configure
script outputs no
saying you are missing this critical functionality of readline. That's the indication that readline is "missing" on your system for the purposes of compilation. The reason Debian splits off header files into a separate package is that not everyone compiles code from scratch on Debian, so -dev
packages contain the dev depdendencies for a library. You only need to install -dev
packages if you are doing development against that library. This question may also be relevant to your follow on question.