Arrow keys no longer work in Python shell after upgrading Mac OS to Sierra

倾然丶 夕夏残阳落幕 提交于 2019-12-03 01:23:00

I solved it by installing python from homebrew:

brew unlink python
brew install python
joanfihu

I had the exact same issue and this command worked for me easy_install -a readline.

Full credit here: ipython complaining about readline

This worked for me:

CFLAGS="-I$(brew --prefix readline)/include -I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" \
LDFLAGS="-L$(brew --prefix readline)/lib -L$(brew --prefix openssl)/lib" \
PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs2 \
pyenv install -v 2.7.11

Source: https://medium.com/@pimterry/setting-up-pyenv-on-os-x-with-homebrew-56c7541fd331#.urbdkrc9l

I'm seeing the same thing and the only "fix" I was able to come up with was to not run the pyenv init - 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.

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

What solved it for me was running the steps mentioned by jsphpl (unlink and install) and then additionally using brew to link python again and allowing the overwrite of conflicting files.

This can happen with upgrading XCode or XCode tools (which often occurs with an OS upgrade) when using brew installed python.

In this case, you just need to reinstall:

brew reinstall python

If you need python 2, remember brew defaults to python3 now, so you need:

brew reinstall python2

Need to configure python's shortcuts.

In shell, run idle3, then update the key shortucts:

How to repeat last command in python interpreter shell?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!