我在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
python:不同包下同名的两个模块和类python: Two modules and classes with the same name under different packages(python:不同包下同名的两个模块和类)
配置 Python 以使用站点包的其他位置Configuring Python to use additional locations for site-packages(配置 Python 以使用站点包的其他位置)
如何在不重复导入顶级名称的情况下构造python包How to structure python packages without repeating top level name for import(如何在不重复导入顶级名称的情况下构造python包)
在 OpenShift 上安装 python 包Install python packages on OpenShift(在 OpenShift 上安装 python 包)
如何刷新 sys.path?How to refresh sys.path?(如何刷新 sys.path?)
分发带有已编译动态共享库的 Python 包Distribute a Python package with a compiled dynamic shared library(分发带有已编译动态共享库的 Python 包)