What's going on? I tried iPython and the regular Python interpreter, both show ^[[A and ^[[B for the up and down arrows instead of previous commands.
Platform: Ubuntu 12.04.
Python: 2.7.3 installed with pythonbrew
Terminal: iTerm 2 on Mac OSX 10.6, connected over SSH.
Has never worked in the Python shell over SSH, but works locally.
Running locale outputs:
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Since you installed Python with pythonbrew, you must install the libreadline-dev
package in your package manager then recompile Python.
The package is named libreadline-dev
or something similar in most Linux distributions (Ubuntu, Debian, Fedora...). This step is not required on Gentoo or Arch systems, which always include dev support for libraries.
This step is also not necessary for Python that you install from the package manager.
Footnote: The locale is irrelevant. The terminal emulator is irrelevant. SSH is irrelevant. I have never seen these factors affect line editing capabilities, although I suppose anything's possible.
Footnote 2: I'm going to submit a patch to the docs for pythonbrew, this is not the first time someone has complained about readline missing. Update: Pull request Update 2: Merged.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With