Seeing escape characters when pressing the arrow keys in python shell
I've solved this issue by installing readline
package:
pip install readline
On OS X, I have different problem.
When I using system python shell, the keys is no problem, but problem in virtualenv. I'd try to reinstall/upgrade virtualenv/readline and nothing fixed.
While I try to import readline
in problem python shell, get this error message:
ImportError: dlopen(/Users/raptor/.virtualenvs/bottle/lib/python2.7/lib-dynload/readline.so, 2): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylibReferenced from: /Users/raptor/.virtualenvs/bottle/lib/python2.7/lib-dynload/readline.soReason: image not found
Cause there is /usr/local/opt/readline/lib/libreadline.7.dylib
but not libreadline.6.dylib
, so I make a symbol link:
ln -s libreadline.7.dylib libreadline.6.dylib
Problem has been solved!
On OS X, Xcode updates sometimes break readline
. Solution:
brew uninstall readlinebrew upgrade python3brew install readlinepip3 install readline
If the problem still persists, try to remove readline
using pip
and install it using easy_install
:
pip3 uninstall readlineeasy_install readline