Error no module named curses

我的梦境 提交于 2019-12-04 01:16:28

Install the UniCurses module from here: https://pypi.python.org/pypi/UniCurses

You may need to alter some of your code in order to use it, as it provides the functionality of NCurses, not the vanilla curses library.

Unfortunately, no direct Python for Windows port of curses exists.

You could also look into installing the curses module from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses.

It allows python's native curses to be used on Windows, so all your standard python curses code can be used.

Got the same error with Python 3.4 on Ubuntu 14.04 and here is how I fixed it.

My /usr/local/lib/python3.4/lib-dynload/ directory did not have the following files -

_curses.cpython-34m.so
_curses_panel.cpython-34m.so

Got a copy of the latest Python 3.4.2 source. Then (extracted &) compiled it:

./configure
make

Now the .so files I need were in build/lib.linux-i686-3.4/ and I copied them to /usr/local/lib/python3.4/lib-dynload/.

That works for me:

pip install windows-curses

inspired by @YKB, I did this for Ubuntu 16.04 and Python3.5.2,

sudo apt-get install libncurses5-dev,

and then go to source code of Python, and make, two new files are created.

_curses.cpython-35m-x86_64-linux-gnu.so
_curses_panel.cpython-35m-x86_64-linux-gnu.so

And then copy them to lib-dynload folder at where you installed your python.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!