Strange Problems With Python After Upgrading to OS

2019-03-31 20:55发布

问题:

After upgrading my OS X Lion to Mavericks, I've encountered with strange problems. At first, It gave me segmentation fault or bus error. After searching for a bit I've noticed that it's related to the readline library. The solution was described by bugs.python.org:

curl -O http://bugs.python.org/file32324/patch_readline_issue_18458.sh 
openssl sha1 patch_readline_issue_18458.sh # the digest should be 7cb0ff57820a027dd4ca242eb2418930f8f46b4c 
sudo sh ./patch_readline_issue_18458.sh

This will disable the readline library. The errors are gone now but I have another problem. In Python shell when I press arrow keys (up, down, left or right) it gives me these: ^[[A, [[C^, ^[[B, ^[[D. I think the problem is still related to the readline library but I don't know how to solve it.

Thanks in advance.

Regards

回答1:

I'm no authority on the guts of Python, so take my advice with caution. But, having encountered the same problem after the Mavericks upgrade (and using Python 2.7), I just did a

easy_install readline

at the command line, and everything seems to be working again. No more segmentation error, and arrow keys in the Python shell appear to be functioning normally.



回答2:

The (brand new) Python 3.3.3rc1 fixes the SegFault problem.

It's here: http://www.python.org/download/releases/3.3.3/