IPython笔记本显示终端输出 [英] IPython notebook shows output in terminal
问题描述
我正在使用IPython笔记本( ipython notebook&
),但是当我尝试通过简单地给出变量名称而按下Shift来打印某些东西以获得任何输出+输入,而不是获取笔记本电脑(单元格旁边)的输出,我从启动笔记本电脑的终端获取它。我想看看笔记本电脑本身的输出,在相关的单元格旁边。我最近遇到了这个问题,之前它运行正常。
I'm using an IPython notebook (ipython notebook &
), but when I try to print something to get any output by simply giving the variable name ans pressing Shift + Enter, instead of getting the output in notebook (next to the cell), I get it in the terminal from where I launch the notebook. I want to see the output in the notebook itself, next to the concerned cell. I'm facing this problem lately, previously it was working fine.
推荐答案
此代码在我的机器上产生同样的问题:
This code produces the same issue on my machine:
import sys
reload(sys)
sys.setdefaultencoding('utf8')
在单元格中运行它,或导入运行该段代码的模块后,所有输出都在终端中结束的笔记本。
After running that in a cell, or importing a module which runs that piece of code, all output ends up in the terminal instead of the notebook.
这篇关于IPython笔记本显示终端输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!