Readline functionality on windows with python 2.7

2019-01-23 01:46发布

问题:

I need to import the readline functionality in a program written in python. I am currently using version 2.7 and the 3rd party packages I have seen only work up to version 2.6. Does anyone know of a 3rd party readline package for Windows with Python 2.7?

回答1:

I believe pyreadline was designed just for this.

easy_install pyreadline
or:
pip install pyreadline

http://pypi.python.org/pypi/pyreadline

Also, use the following for forward/reverse compatibility:

try:
  import readline
except ImportError:
  import pyreadline as readline