I use https://github.com/collective/buildout.python to have all python versions available on my developer machine. The normal buildout however produces python versions where the "import readline" fails.
Turns out there is a bug that python doesn't play nicely with readline 6.3, which is the version included in the buildout. This can easily be fixed in src/readline.cfg Just change the line containing the url for the readline source from
url = https://ftp.gnu.org/gnu/readline/readline-6.3.tar.gz
to
url = https://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz
Thats it. Oh, and don't forget that you need to have some libraries installed
sudo apt-get install libreadline-dev libbz2-dev libssl-dev libncurses5-dev
And: instead of the official github repository you can use my for at:
https://github.com/jhb/buildout.python