Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm attempting to install GNU readline on a CentOS 5 so that I can use it with some Python 2.7 modules, specifically the Cmd module.

I've installed Python2.7 as a standalone library per these instructions to no avail. As I understand it, upgrading the Python that comes shipped with the AWS CentOS image breaks several shared libraries including yum, so it's being compiled and installed separately, however even after going through this process I'm still receiving:

ImportError: No module named readline
share|improve this question
    
I notice that the instructions on that website still have a formatting issue with step 8. Can you verify the contents of /etc/ld.so.conf.d/opt-python2.7.conf for us? –  Lars Rohrbach Mar 9 '12 at 18:21
    
Sure: cat /etc/ld.so.conf.d/opt-python2.7.conf gives /opt/python2.7/lib –  jpredham Mar 9 '12 at 19:00

2 Answers 2

up vote 1 down vote accepted
+50

The dependencies that you want to use with python need to be installed before you build python, otherwise the modules don't get built and installed (if you need another program to test readline, I think fbreader needs it - the non-java version) The output of configure should give you some indication.

once you have that, this is what the Setup file says

GNU readline. Unlike previous Python incarnations, GNU readline is now incorporated in an optional module, configured in the Setup file instead of by a configure script switch. You may have to insert a -L option pointing to the directory where libreadline.* lives, and you may have to change -ltermcap to -ltermlib or perhaps remove it, depending on your system -- see the GNU readline instructions. It's okay for this to be a shared library, too.

readline readline.c -lreadline -ltermcap

share|improve this answer
    
thanks @technosaurus –  jpredham Mar 15 '12 at 21:31

Keeping in mind the instructions you were following, here are some addition steps that I had to take to install readline so that python2.7 can use it:

cd /usr/lib
ln -s libncurses.so.5 libncurses.so
easy_install readline

The installation of readline requires ld to use -lncurses, which means that "libncurses.so" (not just libncurses.so.5) needs to be found in your library path. You may need a similar symbolic link in /usr/lib64 if you have a 64-bit OS installed.

share|improve this answer
    
can you provide info on installing ncurses? I yum install ncurses-devel.x86_64 but still don't see libnurses* in /usr/bin –  jpredham Mar 9 '12 at 21:03
    
yum install ncurses should do it -- you want the ncurses package, not the ncurses-devel package for this. –  Lars Rohrbach Mar 9 '12 at 22:06
    
@jpredham -- any success with ncurses? –  Lars Rohrbach Mar 15 '12 at 21:00
    
thanks for your help, but the hardcoding of readline lib in the setup file was what solved it –  jpredham Mar 15 '12 at 21:31
    
All well and good. Glad it got worked out. –  Lars Rohrbach Mar 15 '12 at 23:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.