我正在尝试使用 PIP 8.1.2 在 Win10 上的 Python 3.3.5 32 位上安装和使用 ipdb(启用 IPython 的 pdb)。我已经在 windows cmd 中通过 PIP 安装(必须单独安装),没有错误:
pip install ipdb
我写了一个简单的测试脚本,希望在打印“测试”字符串ipdb_test.py之前在调试器中停止:
import ipdb
ipdb.set_trace()
print('test')
从 IDLE 编辑器运行它时,会出现以下异常:
Traceback (most recent call last):
File "C:\Python33.5-32\lib\site-packages\ipdb\__main__.py", line 44, in <module>
get_ipython
NameError: name 'get_ipython' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/temp/ipdb_test.py", line 1, in <module>
import ipdb
File "C:\Python33.5-32\lib\site-packages\ipdb\__init__.py", line 7, in <module>
from ipdb.__main__ import set_trace, post_mortem, pm, run # noqa
File "C:\Python33.5-32\lib\site-packages\ipdb\__main__.py", line 51, in <module>
(...)
File "C:\Python33.5-32\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 266, in flush
self.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'