Skip to main content
 首页 » 编程设计

python之Pandas 打印 `tput: unknown terminal "emacs”`

2024年10月24日10haluo1

我正在使用通过 Anaconda 在 Windows 10 上安装的 pandas。

我在 emacs 劣质 Python shell 中运行 IPython 终端。

每次我将 pandas.DataFrame 打印到终端时,我都会收到一条错误消息 tput: unknown terminal "emacs"。

错误消息之后是正确的输出,所以我希望我可以关闭错误消息。

看起来类似于this question .值得一提的是,我的 PATH 环境变量中确实有 Git/bin,但我不知道这会产生什么影响。

如有任何建议,我们将不胜感激。

请您参考如下方法:

我在 Windows 7 下的 Eclipse (Mars 2) 的调试透视图中操作 pandas.DataFrame 时遇到了类似的问题。

当尝试检查 DataFrame 的内容时,控制台将输出:

tput: unknown terminal "emacs" 

而该值将显示 (pending),并且调试 session 将永远卡住。

我发现 tput 命令确实是 cygwing 提供的 unix 命令:

D:\smouton>where tput 
d:\smouton\cygwin64\bin\tput.exe 

我设置的解决方法是在启动 Eclipse 之前修改 PATH 变量。这可以通过启动以下批处理文件而不是 Eclipse 可执行文件来方便地完成:

REM Remove reference to "unixy" stuff before calling eclipse 
REM This avoids 'tput: unknown terminal "emacs"' error when manipulating pandas dataframe 
SET PATH=%PATH:;C:\MinGW\bin;d:\smouton\cygwin64\bin;=;% 
REM launch eclipse 
START "" "C:\Program Files (x86)\Eclipse\eclipse.exe" 

此文件只是从 PATH 中删除 C:\MinGW\bin 和 d:\smouton\cygwin64\bin,然后启动 eclipse。

我想类似的解决方法也可以解决 OP 的 IPython 问题。