簡體   English   中英

在 python3 上為 Ubuntu 安裝 NCurses

[英]Install NCurses on python3 for Ubuntu

我在為Python3安裝ncurses遇到問題。 當我執行正常的sudo apt-get install ncurses-dev ,它似乎是為Python2安裝的,但是當我嘗試為Python3運行我的腳本Python3 ,它說。

ImportError: No module named curses

你如何讓ncursesPython3工作?

嘗試這個:

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

我有同樣的問題。 問題是我的 Ubuntu 安裝中沒有安裝 ncurses。 為了修復它,我跑了:

sudo apt-get install libncurses-dev

然后重新安裝Python。 在我的情況下:

pyenv install 3.8.1

當詢問是否繼續安裝時回答 y (是/否)

這解決了問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM