将Mac OS升级到Sierra后,箭头键在Python Shell中不再起作用 [英] Arrow keys no longer work in Python shell after upgrading Mac OS to Sierra

查看:103
本文介绍了将Mac OS升级到Sierra后,箭头键在Python Shell中不再起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用pyenv全局设置为3.5.2的zsh,iTerm2(3.0.9)和pyenv(1.0.2).

I'm using zsh, iTerm2 (3.0.9), and pyenv (1.0.2) with pyenv global set to 3.5.2.

在Python Shell中,上下箭头键用于工作,以访问历史记录中的先前命令.但是现在升级到OSX 10.12后,它显示控制字符.例如,向上箭头显示:

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:

^[[A

我已经尝试按照

I've tried installing readline as suggested in Seeing escape characters when pressing the arrow keys in python shell 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.

推荐答案

我通过从自制软件安装python来解决了这个问题:

I solved it by installing python from homebrew:

brew unlink python
brew install python

这篇关于将Mac OS升级到Sierra后,箭头键在Python Shell中不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆