How can I get mod_wsgi working on Mac?

前端 未结 9 2081
眼角桃花
眼角桃花 2021-02-08 15:53

I have been trying to install the latest version of mod_wsgi (3.3) since hours on my Mac. I\'m on Snow Leopard and I have the versions of Apache (Apache/2.2.15) and Python 2.6.1

9条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-08 16:26

    I also encountered this error but I didn't want to use brew.

    In my case the cause of the problem was in misconfiguration of python framework used for mod_wsgi that can be checked by
    otool -L /usr/libexec/apache2/mod_wsgi.so

    In my case it pointed to Python 2.7 framework while I was using Python 3.3 and my
    python -> /usr/bin/python
    also pointed to python 3.3 version.

    In order to fix this, I removed already installed /usr/libexec/apache2/mod_wsgi.so .

    Then reconfigured mod_wsgi with command:
    ./configure --with-python=/usr/bin/python --disable-framework
    sudo make
    sudo make install

    This should work fine. But in my case after executing make command I've got a warning about non existing Python framework folder. So I checked what was the real path of my Python framework folder and replaced it in the Makefile under LDFLAGS.

    Changed from:
    -L/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config
    to
    -L/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config-3.3m

    Good way to check the Apache modules if it doesn't work, is:
    apachectl -M

    If some module causes the error, it will print it.

提交回复
热议问题