所以我确实已经安装了curses,我用dpkg检查了它。 现在,当我尝试导入它,这种情况导入诅咒的Python错误 - 不知道为什么
Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "curses.py", line 3, in <module>
myscreen = curses.initscr()
AttributeError: 'module' object has no attribute 'initscr'
我不知道为什么会发生 - 我第一次尝试运行此:
import curses
myscreen = curses.initscr()
myscreen.border(0)
myscreen.addstr(12, 25, "Python curses in action!")
myscreen.refresh()
myscreen.getch()
curses.endwin()
因为我试了一下,出现这种情况。任何人有想法?
你在你的工作目录或你的PYTHONPATH中有一个名为'curses.py'的文件吗? – RichieHindle 2013-04-21 22:59:01