Greg Hewgill Greg Hewgill - 1 year ago 146
Python Question

Why is the Python readline module not available on OS X?

The documentation of the Python

module says "Availability: Unix". However, it doesn't appear to be available on OS X, although other modules marked as Unix are available. Here is what I'm using:

$ uname -a
Darwin greg.local 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
$ which python
$ python
Python 2.3.5 (#1, Nov 26 2007, 09:16:55)
[GCC 4.0.1 (Apple Computer, Inc. build 5363) (+4864187)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
File "", line 1, in ?
ImportError: No module named readline

I have also installed Python 2.5 through MacPorts but
is not available there either.

What can I do to provide
functionality for Python's
function on OS X?

Answer Source

Have you tried to install the py-readline (or py25-readline for Python 2.5) port?

Also, in the snippet above, you are NOT using the MacPort python, but rather the Apple Python.

The MacPort version should be located in the /opt/local directory structure. You should check your path.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download