Python debugger (pdb) stopped handlying up/down arrows, shows ^[[A instead(Python 调试器 (pdb) 停止处理向上/向下箭头,而是显示 ^[[A)
问题描述
我在 Ubuntu Linux 11.04 (natty) 机器上的 virtualenv 中使用 python 2.6.我的 (django) python 代码中有这段代码:
I am using python 2.6 in a virtualenv on an Ubuntu Linux 11.04 (natty) machine. I have this code in my (django) python code:
import pdb ; pdb.set_trace()
为了启动 python 调试器 (pdb).
in order to launch the python debugger (pdb).
直到今天,这一切都很好.但是现在当 pdb 启动时,它可以用于调试和运行以及断点等,但是当我按 向上箭头 显示上一个命令时,它会打印 ^[[A一个不上去.当我键入内容并按 Home 时,它会打印 ^[OH 而不是移动光标.
Up until today, this worked fine. But now when the pdb starts, it works for debugging and running and breakpoints etc, but when I press the up arrow to show the previous command it prints ^[[A instead an doesn't go up. When I type something and press Home, it prints ^[OH instead of moving the cursor.
我可以使用 up/home/etc.在启动我的 python django unittests(它有 pdb 调用)的 bash 终端中很好.
I can use up/home/etc. fine in the bash terminal which launches my python django unittests (which has the pdb call).
发生了什么事?如何修复我的 pdb?我的 readline 出了什么问题?
What's going on? How do I fix my pdb? What's wrong with my readline?
推荐答案
由于某种原因,您似乎缺少 readline 包.只需键入 pip install readline 即可安装它,它应该会按预期运行.如果您不在 venv 中,请记住以超级用户身份输入.
Looks like from some reason you are missing the readline package.
Simply install it by typing pip install readline and it should behave as expected. Remember to type it as superuser if you're not in venv.
这篇关于Python 调试器 (pdb) 停止处理向上/向下箭头,而是显示 ^[[A的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Python 调试器 (pdb) 停止处理向上/向下箭头,而是显示 ^[[A
基础教程推荐
- 尝试制作WhatsApp机器人 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
