Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anaconda - arrow keys not work well in python shell

I installed Anaconda3 on manjaro (with i3wm and Urxvt). When I go into python interpreter, it is OK to type python script and execute. But when key arrows are pressed to call up history, everything messed up. Here is a screenshot shows the situation after I pressed my up keys several times.enter image description hereAnd another problem is when backspace is pressed there will be one more space appear but not delete characters before.

I have tried to find some post that saying escape chars appears in Anaconda python and the solution seems to be install ncurses or readline. When I tried to install them, I found both of them are already in place. Any idea to help with my problem?

like image 276
Page David Avatar asked Jul 05 '18 05:07

Page David


1 Answers

You will need to put a compiled terminfo entry in anaconda's temrinfo directory. The entry for urxvt needs to be placed in $_CONDA_ROOT/share/terminfo/r/. I ran the following copy and verified it works now:

cp /usr/share/terminfo/r/rxvt-unicode-256color ~/anaconda/share/terminfo/r/

If you have multiple environments you will have to do it for them as well:

cp /usr/share/terminfo/r/rxvt-unicode-256color ~/anaconda/envs/data_science/share/terminfo/r/

like image 63
g4vagai Avatar answered Sep 25 '22 02:09

g4vagai