Question

As in the title, my system version is Ubuntu 10.04. The default version of Python is 2.6.5. When I start python2.6 in command line and

import readline

This works well.

Then I compile the python 2.7.4 (Downloaded from www.python.org/getit). Nightmare began.

Here is how I installed Python 2.7.4:

./configure --prefix=/usr
make
su root
make install

Then tried import readline:

Python 2.7.4 (default, Apr 11 2013, 11:17:09) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named readline

Googled, firstly what I did is

sudo apt-get install libreadline5-dev
sudo ldconfig

Reinstall, does not work.

Then tried to install libpython and reinstall python 2.7.4, still does not work. But the strange thing is that at the last few lines of command "make", the information is like this:

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _sqlite3           bsddb185        
bz2                dbm                gdbm            
sunaudiodev                                           
To find the necessary bits, look in setup.py in detect_modules() for the module's name. 

Seems there is no readline, but it just does not work!

BTW, here is another information might help:

/usr/bin/python -c "import readline; print readline.__doc__"
Importing this module enables command line editing using GNU readline.

Anyone can help me for this... Thank you in advance.

Was it helpful?

Solution

I tried again, installed these packets:

sudo apt-get install build-essential
sudo apt-get install libreadline5-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Then remove everything about python2.7 including in /usr/local/bin, /usr/bin, etc and reinstall.

This time it works...

Ok...Hope this will help people who has the same problem with me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top