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'm seeing the same thing and the only "fix" I was able to come up with was to not run the <code>pyenv init -</code> command in my .zshrc file. That however will inhibit the functioning of virtual environments.. and so it's not a fix but a workaround to get the python shell history to work again.</p>

<p>I'm continuing to look and see if there is a permanent fix as I'm not nearly as productive without it. </p>

python osx zsh iterm2 pyenv