有没有办法在无缓冲模式下运行 IPython?
python -u
与为标准 python shell 提供无缓冲 IO相同的方式
从 Python 的手册页:
-u Force stdin, stdout and stderr to be totally unbuffered. On systems
where it matters, also put stdin, stdout and stderr in binary mode.
Note that there is internal buffering in xreadlines(), readlines()
and file-object iterators ("for line in sys.stdin") which is not
influenced by this option. To work around this, you will want to use
"sys.stdin.readline()" inside a "while 1:" loop.
如果使用无缓冲模式会干扰 readline,那么它肯定会更加干扰 iPython 为您提供的所有神奇编辑和自动完成功能。我倾向于怀疑这就是为什么该命令行选项不在 iPython 中的原因。
尝试:
python -u `which ipython`
不过,不确定它是否会起作用。