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 (r261:67515) that come with the system.
I downloaded mod_wsgi-3.3.tar.gz from http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-3.3.tar.gz
Extracted the file and executed the following through terminal:
./configure make sudo make install
I added LoadModule wsgi_module modules/mod_wsgi.so to my httpd.conf.
Restarted Apache by disabling and enabling Web Sharing from the control panel.
localhost stops working until I remove the line I added httpd.conf :(
Please help. Thanks in advance.
On OS X 10.8 Mountain Lion,
brew install mod_wsgi
fails. This answer on stackexchange suggests the location of the XCode toolchain has changed. It fixed my problem and hopefully helps other people who end up here on 10.8 trying to install mod_wsgi.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 underLDFLAGS
.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.
I use the homebrew installed version of
mod_wsgi
. That gives me a universal version ofmod_wsgi
that works with the vanilla apache.The problem you had was the path to mod_wsgi.so. On OS X the appropriate line is
I was having trouble getting mod_wsgi to work as well even using different peoples advice and it wasn't working, so I finally used this website: https://pypi.python.org/pypi/mod_wsgi
Downloaded the mod_wsgi 4.5.15 file
Opened the file in a location I liked
Went to folder location in terminal
Did
python3 setup.py install
(or python if you're using a different version)I have a MacBook Pro Version 10.12.5 in case this helps anyone.
Mac OS X comes with apache 2, to install mod_wsgi just install homebrew and run the following command.
go to apache2/modules/ and search for mod_wsgi.so
after this goto apache2/conf/ and do
and add the following line
LoadModule wsgi_module modules/mod_wsgi.so