问题描述
我在为Python3
安装ncurses
遇到问题。
当我执行正常的sudo apt-get install ncurses-dev
,它似乎是为Python2
安装的,但是当我尝试为Python3
运行我的脚本Python3
,它说。
ImportError: No module named curses
你如何让ncurses
为Python3
工作?
1楼
尝试这个:
import 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
>>>
2楼
我有同样的问题。 问题是我的 Ubuntu 安装中没有安装 ncurses。 为了修复它,我跑了:
sudo apt-get install libncurses-dev
然后重新安装Python。 在我的情况下:
pyenv install 3.8.1
当询问是否继续安装时回答 y ? (是/否)
这解决了问题。