[mod_python] Trouble on OSX - Leopard again

Graham Dumpleton graham.dumpleton at gmail.com
Fri Jan 4 19:07:10 EST 2008

On 04/01/2008, Johannes Hoffart <johannes at nudgenudge.eu> wrote:
> Hi,
> I tried to install mod_python on osx and ran into the x86_64 trouble -
> I then followed the solution in this mailing list, which works nicely.
> There is one limitation, though, the _psp.so is still not x86_64:
> file _psp.so
> _psp.so: Mach-O universal binary with 2 architectures
> _psp.so (for architecture i386):        Mach-O bundle i386
> _psp.so (for architecture ppc7400):     Mach-O bundle ppc
> The corresponding output in the make process shows that it is only
> compiled for those two archs, but I cannot find the right place in the
> Makefile to add x86_64. Apache loads fine, but throws this error upon
> accessing a .psp file:
> ImportError: dlopen(/Library/Python/2.5/site-packages/mod_python/
> _psp.so, 2): no suitable image found.  Did find:
>         /Library/Python/2.5/site-packages/mod_python/_psp.so: no matching
> architecture in universal wrapper
> I hope someone can point me in the right direction.

Modify dist/setup.py.in around:

class PSPExtension(Extension):
    """a class that helps build the PSP extension"""
    def __init__(self, source_dir, include_dirs):
        Extension.__init__(self, "mod_python._psp",
                               [os.path.join(source_dir, source_file)
for source_file in
                                    ("psp_string.c", "psp_parser.c",

Add the required additional flags into the Extension definition. You
probably want to use extra_compile_args and extra_link_args. See:


After changes, you will need to run configure again.


More information about the Mod_python mailing list