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

后端 未结 7 971
甜味超标
甜味超标 2020-12-29 21:42

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

In the Python shell, the up and down arrow keys used to work, to access the previou

相关标签:
7条回答
  • 2020-12-29 21:58

    I solved it by installing python from homebrew:

    brew unlink python
    brew install python
    
    0 讨论(0)
  • 2020-12-29 21:59

    Need to configure python's shortcuts.

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

    How to repeat last command in python interpreter shell?

    0 讨论(0)
  • 2020-12-29 22:05

    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
    
    0 讨论(0)
  • 2020-12-29 22:11

    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

    0 讨论(0)
  • 2020-12-29 22:12

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

    Full credit here: ipython complaining about readline

    0 讨论(0)
  • 2020-12-29 22:18

    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.

    0 讨论(0)
提交回复
热议问题