错误没有名为curses的模块 [英] Error no module named curses

查看:80
本文介绍了错误没有名为curses的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行以下代码时...

When I try to run the following code...

from telnetsrvlib import *

if __name__ == '__main__':
"Testing - Accept a single connection"
class TNS(SocketServer.TCPServer):
    allow_reuse_address = True

class TNH(TelnetHandler):
    def cmdECHO(self, params):
        """ [<arg> ...]
        Echo parameters
        Echo command line parameters back to user, one per line.
        """
        self.writeline("Parameters:")
        for item in params:
            self.writeline("\t%s" % item)
    def cmdTIME(self, params):
        """
        Print Time
        Added by dilbert
        """
        self.writeline(time.ctime())

logging.getLogger('').setLevel(logging.DEBUG)

tns = TNS(("0.0.0.0", 8023), TNH)
tns.serve_forever()

我收到此错误

Traceback (most recent call last):
File ".\telserv.py", line 1, in <module>
from telnetsrvlib import *
File "C:\Python27\lib\site-packages\telnetsrvlib-1.0.2-py2.4.egg\telnetsrvlib.py", line 31, in <module>
import curses.ascii
  File "C:\Python27\lib\curses\__init__.py", line 15, in <module>
from _curses import *

我正在运行 python 2.7 并导入了 telnetsrvlib 库,我正在 Windows 7 上运行代码.任何帮助将不胜感激.

I am running python 2.7 and have imported the telnetsrvlib library and I am running the code on windows 7. Any help would be appreciated.

推荐答案

从这里安装 UniCurses 模块:https://pypi.python.org/pypi/UniCurses

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

您可能需要更改一些代码才能使用它,因为它提供了 NCurses 的功能,而不是普通的 curses 库.

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.

不幸的是,不存在用于 Windows 端口的直接 Python 诅咒端口.

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

这篇关于错误没有名为curses的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆