exec code in self.locals
错误主要是因为在 python3 环境下 , 进行 debug 调试,源码没有进行更新导致.

需要将 exec code in self.locals 修改为 

exec(code in self.locals)

注:
 文件名不要写为 code.py 会造成 ImportError: cannot import name 'InteractiveInterpreter'  错误

也就是说 debug 的文件名称不可以为 code.py 

 

如果觉得文章不错,可以分享给其他人哟~