Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
299 views
in Technique[技术] by (71.8m points)

python - ipython complaining about readline

When I install ipython on my osx and run it, I get the following warning:

 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
 site-packages/IPython/utils/rlineimpl.py:96:
 RuntimeWarning: Leopard libedit detected - readline will not be wel
 behaved including some crashes on tab completion, and incorrect
 history navigation. It is highly recommended that you install
 readline, which is easy_installable with: 'easy_install readline'

I have have installed readline, and do not use the system python that was originally installed in /Library/Frameworks/Python.framework/Versions/2.7/bin/python$. The /usr/bin/python points to version 2.7 as shown below

uname -a
Darwin macbook.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 
16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

$sudo pip install readline ipython

$ipython --version
0.11

$/usr/bin/python --version # 
Python 2.7.1 

$which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python

I have read the question in Python sys.path modification not working - I added /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/readline-6.2.1-py2.7.egg-info to the /Library/Frameworks/Python.framework/Versions/2.7/bin/ipython so that it now looks like this: http://pastebin.com/raw.php?i=dVnxufbS

but I cannot figure out why I am getting the following error:

File
"/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython",
line 9
sys.path.insert(0,"/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/readline-6.2.1-py2.7.egg-info")

I do not think the above path is an issue, and my goal is to get ipython to working without complaining about readline even though it is installed and imports correctly.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When pip installs readline, it will never be imported, because readline.so goes in site-packages, which ends up behind the libedit System one, located in lib-dynload (OSX Python path order is very odd). easy_install -a readline will actually install usable readline.

So you can either use easy_install, or use pip and muck about with your PYTHONPATH/sys.path (which essentially means: DO NOT USE PIP).

A bit more detail on the IPython list (though there really isn't anything IPython-specific about this issue): http://mail.scipy.org/pipermail/ipython-user/2011-September/008426.html

EDIT: extra note about virtualenv.

There is a bug in virtualenv < 1.8.3, where readline would not be properly staged when you create an env.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...