Python, readline and OS X

I have installed Python 2.5 on my new Intel Mac but I can't for the life
of me get readline to work. I have libreadline installed, I've tried
copying readline.so from my Python 2.3 installation into 2.5, I've
searched the web, and no joy. Could someone please give me a clue?

Advertisements

Ron Garret wrote:
> I have installed Python 2.5 on my new Intel Mac but I can't for the life
> of me get readline to work. I have libreadline installed, I've tried
> copying readline.so from my Python 2.3 installation into 2.5, I've
> searched the web, and no joy. Could someone please give me a clue?
>
> rg

Where have you installed libreadline? Is LD_LIBRARY_PATH pointing to the
directory libreadline.dylib? Did you install libreadline with fink? If
so, try

setenv LD_LIBRARY_PATH /sw/lib

before compiling (csh).

Bash (OSX default) and similar shells use this silly 2 part syntax:

LD_LIBRARY_PATH=/sw/lib
export LD_LIBRARY_PATH

Do a "locate libreadline.dylib" and set the LD_LIBRARY_PATH to the
containing directory and then

Advertisements

Ron Garret wrote:
> I have installed Python 2.5 on my new Intel Mac but I can't for the life
> of me get readline to work. I have libreadline installed, I've tried
> copying readline.so from my Python 2.3 installation into 2.5, I've
> searched the web, and no joy. Could someone please give me a clue?
>
> rg

In article <45c28755$0$322$4all.nl>,
Irmen de Jong <> wrote:
> Ron Garret wrote:
> > I have installed Python 2.5 on my new Intel Mac but I can't for the life
> > of me get readline to work. I have libreadline installed, I've tried
> > copying readline.so from my Python 2.3 installation into 2.5, I've
> > searched the web, and no joy. Could someone please give me a clue?
> >
> > rg
>
> Does the info in a blog article that I wrote help?
>
> http://www.razorvine.net/frog/user/irmen/article/2006-05-08/87

No, because I'm not using Fink. But maybe I can adapt your solution.
> I used this when I compiled my Python 2.5 on my mac, and
> it seemed to work ;-)
>
> I'm now using the python.org binary distribution though and that seems to
> contain a working readline as well.... ?

You must re-compile python, starting with configure so that configure
can identify the readline libraries. Otherwise it will compile with no
readline, which is your current situation
>>Bash (OSX default) and similar shells use this silly 2 part syntax:
>>
>> LD_LIBRARY_PATH=/sw/lib
>> export LD_LIBRARY_PATH
>
> Actually you can do it in one line: export LD_LIBRARY_PATH=whatever

Hi James, hi Ron,
> Where have you installed libreadline? Is LD_LIBRARY_PATH pointing to the
> directory libreadline.dylib? Did you install libreadline with fink? If
> so, try
>
> setenv LD_LIBRARY_PATH /sw/lib

That would probably make no difference since on Mac OS X that variable
is called DYLD_LIBRARY_PATH (contrary to SysV Unices).
> Bash (OSX default) and similar shells use this silly 2 part syntax:
>
> LD_LIBRARY_PATH=/sw/lib
> export LD_LIBRARY_PATH

It's just your way of using it that makes it a 2 part syntax:

export DYLD_LIBRARY_PATH=/sw/lib

does the trick. And by the way: the bash construct is far less error
prone regarding quoting when used in shell scripts.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!