简体   繁体   English

IPython笔记本显示终端输出

[英]IPython notebook shows output in terminal

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. 我正在使用IPython笔记本( ipython notebook & ),但当我尝试通过简单地给出变量名称而按下Shift + Enter来输出任何输出时,而不是在笔记本中获取输出(单元格旁边),我从启动笔记本电脑的终端到达。 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. 在单元格中运行它或导入运行该段代码的模块后,所有输出都在终端而不是笔记本中结束。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM