Python调试器(pdb)停止上/下箭头,显示^ [[A代替 [英] Python debugger (pdb) stopped handlying up/down arrows, shows ^[[A instead

查看:446
本文介绍了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代替的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆