Install NCurses on python3 for Ubuntu

Solomon picture Solomon · Oct 22, 2015 · Viewed 7k times · Source

I'm having issues installing ncurses for Python3. When I did the normal sudo apt-get install ncurses-dev, it appeared to install for Python2 but when I try to run my script for Python3, it says.

ImportError: No module named curses

How would you get ncurses to work for Python3?

Answer

jgritty picture jgritty · Oct 22, 2015

Try this:

import curses

curses is ncurses. It's also built in to python, there's nothing to install.

Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-65-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Mon Oct 19 19:06:03 2015 from xxx.xxx.xxx.xxx
me@ubuntu:~$ python3
Python 3.4.0 (default, Jun 19 2015, 14:20:21) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
>>>