>>^[[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:491441검색

系统环境: 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으로 문의하세요.