>>^[[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 までご連絡ください。