问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/23306893/ipython-notebook-shows-output-in-terminal