2

我在 64 位 Linux 操作系统上使用 Enthought 的 Canopy 环境。在与编辑器相连的 Ipython 控制台中一切正常。但是当我在终端中使用 ipython 并尝试使用魔法函数时,我收到以下错误。

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-3-29a4050aa687> in <module>()
----> 1 get_ipython().show_usage()

/home/shahensha/Development/Canopy/appdata/canopy-1.0.3.1262.rh5-x86_64/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in show_usage(self)
   2931     def show_usage(self):
   2932         """Show a usage message"""
-> 2933         page.page(IPython.core.usage.interactive_usage)
   2934 
   2935     def extract_input_lines(self, range_str, raw=False):

/home/shahensha/Development/Canopy/appdata/canopy-1.0.3.1262.rh5-x86_64/lib/python2.7/site-packages/IPython/core/page.pyc in page(strng, start, screen_lines, pager_cmd)
    188     if screen_lines <= 0:
    189         try:
--> 190             screen_lines += _detect_screen_size(screen_lines_def)
    191         except (TypeError, UnsupportedOperation):
    192             print(str_toprint, file=io.stdout)

/home/shahensha/Development/Canopy/appdata/canopy-1.0.3.1262.rh5-x86_64/lib/python2.7/site-packages/IPython/core/page.pyc in _detect_screen_size(screen_lines_def)
    112     # Proceed with curses initialization
    113     try:
--> 114         scr = curses.initscr()
    115     except AttributeError:
    116         # Curses on Solaris may not be complete, so we can't use it there

/home/shahensha/Development/Canopy/appdata/canopy-1.0.3.1262.rh5-x86_64/lib/python2.7/curses/__init__.pyc in initscr()
     31     # instead of calling exit() in error cases.
     32     setupterm(term=_os.environ.get("TERM", "unknown"),
---> 33               fd=_sys.__stdout__.fileno())
     34     stdscr = _curses.initscr()
     35     for key, value in _curses.__dict__.items():

error: setupterm: could not find terminfo database

所以,我安装了一个裸骨 iPython shell,它不是 Canopy 提供的,并在那里尝试了相同的魔法功能,它工作正常。

我在安装过程中做错了吗?请帮忙

非常感谢shahensha

4

3 回答 3

4

这不是一个解决方案,而只是一个观察。我的桌面是 MacOS-X,我连接到 Centos 机器以运行 64 位的 Enthought Canopy。如果我从 iterm2 SSH,我会收到与 OP 相同的错误消息,但如果我使用终端应用程序则不会。我不确定根本原因是什么,但可能有人可以验证类似情况是否适用于 linux。有趣的是,我可以在本地树冠上使用 iterm2 或终端,而不会出现任何问题。

更新:

我刚刚注意到 iterm2 中的 TERM 环境变量在"xterm"终端应用程序显示时设置为"xterm-256color". 在终端中运行 Canopy ipython 之前发出命令export TERM="xterm-256color"可以解决 iterm2 中的问题。

于 2013-07-19T19:59:18.053 回答
0

问题重现:

$ python -c 'import curses; curses.setupterm()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
_curses.error: setupterm: could not find terminfo database

这个irc 日志让我想到这个错误与 libncursesw 有关。

我的 Canopy 版本是 1.0.3.1262.rh5-x86_64。我已将其安装到~/src/canopy.

~/src/canopy/appdata/canopy-1.0.3.1262.rh5-x86_64/lib我们可以看到我的树冠安装有 libncursesw.so.5.7。

我的机器(Debian Wheezy 64bit)有 libncursesw.so.5.9(in /lib/x86_64-linux-gnu/libncursesw.so.5.9)。我做了天篷用这个。您可以使用 LD_PRELOAD 并指向 .so 文件来打开/关闭问题。

解决方案

将 libncurses.so.5.7 替换为 libncurses.so.5.9:

CANOPYDIR=$HOME/src/canopy
CANOPYLIBS=$CANOPYDIR/appdata/canopy-1.0.3.1262.rh5-x86_64/lib/
SYSTEMLIBS=/lib/x86_64-linux-gnu

cp $SYSTEMLIBS/libncurses.so.5.9 $CANOPYLIBS
ln -sf $CANOPYLIBS/libncurses.so.5.9 $CANOPYLIBS/libncurses.so.5
于 2013-07-28T21:06:38.983 回答
0

Canopy User Python 似乎不是您的默认设置。请参阅这篇文章: https: //support.enthought.com/entries/23646538-Make-Canopy-s-Python-be-your-default-Python-ie-on-the-PATH-

更新:这里不正确 - 相反,请参阅 batu 的解决方法答案。

于 2013-07-01T01:41:57.727 回答