問題描述
我在 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模板網!