Arrow keys no longer work in Python shell after upgrading Mac OS to Sierra
<p>I'm using zsh, iTerm2 (3.0.9), and pyenv (1.0.2) with pyenv global set to 3.5.2.</p>

<p>In the Python shell, the up and down arrow keys used to work, to access the previous commands in the history. But now after upgrading to OSX 10.12, instead it shows control characters. For example up arrow displays:</p>

<pre><code>^[[A
</code></pre>

<p>I've tried installing readline as suggested in <a href="http://stackoverflow.com/questions/893053/seeing-escape-characters-when-pressing-the-arrow-keys-in-python-shell">Seeing escape characters when pressing the arrow keys in python shell</a> but that didn't help. I don't have the PYTHONSTARTUP variable but didn't used to before, and not sure how that interacts with pyenv.</p>

<p>I had the exact same issue and this command worked for me easy_install -a readline</p>

<p>Full credit here: <a href="http://stackoverflow.com/questions/7375545/ipython-complaining-about-readline">ipython complaining about readline</a></p>

python osx zsh iterm2 pyenv