Solomon
Solomon

Reputation: 189

Install NCurses on python3 for Ubuntu

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?

Upvotes: 6

Views: 19759

Answers (2)

Joshua
Joshua

Reputation: 5494

I had this same problem. The issue was that ncurses was not installed on my Ubuntu installation. To fix it, I ran:

sudo apt-get install libncurses-dev

and then reinstalled Python. In my case with:

pyenv install 3.8.1

Answering y when asked continue with installation? (y/N)

This fixed the problem.

Upvotes: 11

jgritty
jgritty

Reputation: 11915

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
>>> 

Upvotes: 1

Related Questions