4

I'm using ipython

Inside the python shell, when I press up instead of showing the last command, it prints

^[[A

also CTRL-[keys] are fubar. CTRL-p prints

^P

Everything is normal under terminal\bash

My guess is that it is an encoding problem. I'd like to either enable the full encoding in ipython or changer the encoding of the shell which runs ipython.

Or any other helpful information is welcome

1

For me, I needed to create ~/.inputrc, and fill it with my preferences. For me, this is:

set editing-mode emacs
"\e[1;5C": forward-word
"\e[1;5D": backward-word

The \e[1;5C, for me, is the sequence that means Ctrl+. Yours is likely the same, but you can figure it out in bash by typing: Ctrl+V, Ctrl+. For me, this shows, ^[[1;5C, and you need to know that ^[ means "escape", which is the \e above. The rest ([1;5C) is just literal, copy it. forward-word is the command to execute on this key sequence, i.e., I want my Ctrl+arrows to skip words.

1

First, you can try

pip install readline

Also, please see whether you have libncurses5-dev or the equivalent.

0

This worked for me (using OSX and pyenv):

CFLAGS="-I$(brew --prefix readline)/include -I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" \
LDFLAGS="-L$(brew --prefix readline)/lib -L$(brew --prefix openssl)/lib" \
PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs2 \
pyenv install -v 2.7.11

Source: https://medium.com/@pimterry/setting-up-pyenv-on-os-x-with-homebrew-56c7541fd331#.urbdkrc9l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.