在Ubuntu的python3上安装NCurses

问题描述 投票:1回答:2

我在为ncurses安装Python3时遇到问题。当我执行正常的sudo apt-get install ncurses-dev时,它似乎已安装在Python2上,但是当我尝试为Python3运行脚本时,它说。

ImportError: No module named curses

您将如何使ncurses成为Python3

python python-3.x ncurses python-curses
2个回答
0
投票

我有同样的问题。问题是在我的Ubuntu安装中未安装ncurses。要解决它,我跑了:

sudo apt-get install libncurses-dev

然后重新安装Python。就我而言:

pyenv install 3.8.1

被询问时回答是否继续安装? (y / N)

此问题已解决。


-1
投票

尝试一下:

import curses

curses是ncurses。它也内置在python中,没有任何安装。

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
>>> 
© www.soinside.com 2019 - 2024. All rights reserved.