出现这种问题的原因是你没有在jupyter notebook上运行你的代码 解决方法: 1、安装IPython pip install ipython 2、代码移至jupyter notebook或者Anaconda上进行