根据这篇热门的thread's开篇文章的描述,我尝试启动IPython会话。
因此,我在Spyder(python 2.7)中执行以下代码:
from IPython import embed
zz = 1
embed()
我明白了:
Python 2.7.15 |Anaconda custom (64-bit)| (default, May 1 2018, 18:37:09) [MSC v.1500 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 5.8.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
Do you really want to exit ([y]/n)?
由于某种原因,它会自动退出。确认给出了以下声明:
in[2]: zz
Traceback (most recent call last):
File "<ipython-input-2-15546de8c3b0>", line 1, in <module>
zz
NameError: name 'zz' is not defined