I am using ipython on Mac OS 10.5 with python 2.5.1 (I would actually like to use ipython for 2.6.1, but it doesn’t seem to be available?)
I installed ipython via easy_install. It works but is missing gnu readline (needed for nice searching of command line history with ctrl-R, etc.)
I found a blog post and other sources saying this could be fixed by
sudo easy_install -f http://ipython.scipy.org/dist/ readline
However, this leads to build errors in readline.c
, particularly undeclared functions like rl_compentry_func_t
and rl_catch_signals
.
Has anyone seen these errors? Is there another way to get ipython installed with readline?
If you want to use vi keys in your ipython, check out stackoverflow.com/questions/10394302/…
You can install everything you need with essentially one command using MacPorts. First download and install MacPorts from http://www.macports.org/.
Then just do the following in the terminal:
1) sudo port -v selfupdate
2) sudo port -v install py26-ipython
That will install python2.6, ipython for python 2.6 and readline for you. The command to start ipython will be located at /opt/local/bin/ipython2.6
“I would actually like to use ipython for 2.6.1”
It is available. I’m using it with 2.6.1 on os x. You just need to install the official python 2.6.1 distribution, then install ipython with easy_install.
To install ipython on Snow Leopard or Lion without using MacPorts, you can simply do:
(Note that if you use the “pip” to install readline, then ipython won’t see the readline library, not sure why).
Edit:
If you had ipython installed remove it with
or
Then make sure you have installed readline first and reinstall iptyhon
For some reasons, if readline wasn’t present during the installation, it will install itself without support for readline or it use the default mac readline.
An alternative if you don’t want to use ports. Caution: This is not upgrade safe.
Install
ipython
andreadline
as normal:Find the full path to your
readline
egg. For python 2.6 this will probably be:Edit
ipython
with your favourite text editor:Before the final line in the file
sys.exit
, insert:Save and exit (
:wq
).Check readline is working correct:
this worked for me (I’m using python 2.7, for other versions you’ll need to edit):
install readline however you want (pip, homebrew, macports, etc)
Success! and it works with virtualenv, and virtualenvwrapper, and no need to modify ipython 🙂
The only working way on MacOS Mavericks is to:
workon myproject_name
pip uninstall readline ipython
easy_install readline
pip install ipython
It’s work well on my MacOS and tested a long time.