>>^[[C^[[D"等字样. 但在非virtualenv环境的Python Sh"/> >>^[[C^[[D"等字样. 但在非virtualenv环境的Python Sh">

首頁  >  文章  >  後端開發  >  Python Shell 中敲击方向键显示「^[[C^[[D」,原因是什么?如何修复?

Python Shell 中敲击方向键显示「^[[C^[[D」,原因是什么?如何修复?

WBOY
WBOY原創
2016-06-06 16:03:491438瀏覽

系统环境: OS X 10.8
Python: version 2.7.5, built from source, isolated by virtualenv.
问题描述: 通过"source bin/active"进入virtualenv环境后, 在Python Shell中敲击方向键, 会出现">>>^[[C^[[D"等字样. 但在非virtualenv环境的Python Shell(系统自带版本, 源码构建版本)中并不会出现这种现象. 我想知道为什么会出现这样的问题, 以及如何修复.
PS: 小白问题, 才疏学浅, google无果后上来求教.
====================================================
Stackoverflow上有类似的问题:

  • input - Python shell: Arrow keys do not work on remote machine
  • How to repeat last command in python interpreter shell?
Python Doc: 2. Using the Python Interpreter
====================================================
感谢@吴涛的回答, 我基本知道从哪里入手解决这个问题了, 但是我的情况可能更加复杂一点, 原因可能与codecs这个package有关, 问题是在使用这个库之后才出现的, 与 python - Arrow keys in Putty returning [[A^ [[D^ [[B^ instead of moving the cursor 的描述可能有关联.
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn