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

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

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

WBOY
WBOYOriginal
2016-06-06 16:03:491441Durchsuche

系统环境: 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 的描述可能有关联.
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn