Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python can't compile _curses module on Debian Lenny

Tags:

python

curses

My Python (2.6) installation on a few servers has been compiled without curses support which I now need, although the servers have libncurses5 installed, Python did not compile the bindings for it so when I "import curses" I get:

"ImportError: No module named _curses"

my /lib/ dir has the following files and symlinks:

lrwxrwxrwx 1 root root   17 2010-02-13 05:50 /lib/libncurses.so.5 -> libncurses.so.5.7
-rw-r--r-- 1 root root 251K 2008-12-14 22:31 /lib/libncurses.so.5.7
lrwxrwxrwx 1 root root   18 2010-02-13 05:50 /lib/libncursesw.so.5 -> libncursesw.so.5.7
-rw-r--r-- 1 root root 299K 2008-12-14 22:31 /lib/libncursesw.so.5.7

and /lib64/ has:

lrwxrwxrwx 1 root root   20 2010-08-13 12:26 /lib64/libncurses.so -> /lib/libncurses.so.5
lrwxrwxrwx 1 root root   17 2010-02-13 05:50 /lib64/libncurses.so.5 -> libncurses.so.5.7
-rw-r--r-- 1 root root 251K 2008-12-14 22:31 /lib64/libncurses.so.5.7
lrwxrwxrwx 1 root root   18 2010-02-13 05:50 /lib64/libncursesw.so.5 -> libncursesw.so.5.7
-rw-r--r-- 1 root root 299K 2008-12-14 22:31 /lib64/libncursesw.so.5.7

/usr/lib64 and /usr/lib both have have :

lrwxrwxrwx 1 root root 20 2010-08-13 12:20 /usr/lib64/libncurses.so -> /lib/libncurses.so.5

When I try to 'make' python again, I get back at the end the following warning:

Failed to find the necessary bits to build these modules:
_curses_panel      _tkinter           bsddb185        
bz2                dl                 gdbm            
imageop            readline           sunaudiodev     
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:
    _curses 

What do I need to do to recompile Python with curses support? What am I missing here?

Thanks!

like image 219
Harel Avatar asked Oct 27 '25 07:10

Harel


2 Answers

Yes, that's right. Installing libncurses5-dev and running 'make' and 'make install' on the python installation did the trick. I had encountered the error with _curses first while trying to install and fire up bpython on my custom python installation.

like image 179
Sharan Avatar answered Oct 28 '25 22:10

Sharan


I'm not sure which of these actions resolved my problem but one of them did. I installed libncurses5-dev and libreadline5-dev, recompiled python and reinstalled (make / make install). Huzza

like image 39
Harel Avatar answered Oct 28 '25 21:10

Harel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!