Photo Credit: Wikimedia Commons
If you have a Mac OS X Leopard on an Intel platform, and you are interested in installing mod_python using your default apache setup and the python that comes with the Framework, even more if you want to give PyCAPTCHA a try together with mod_python, then check out this post! I’m covering also the installation of required libraries for PyCAPTCHA under Leopard (FreeType2, libjpeg, PIL)
If you have Apple’s Xcode installed, compiling mod_python for Leopard to use with the system provided versions of httpd, python, etc. should be as simple as running these commands:
Configure Apache to load mod_python
/private/etc/apache2/httpd.conf with your favorite editor and add the following line:
This is just an example, I recommend reading the mod_python manual for more information.
Open /private/etc/apache2/users/username.conf with your favorite editor and add:
Restart Apache with the command below:
In order to build and install PyCAPTCHA you’ll need to compile, or make sure that you have these required libraries:
- PIL (Python Imaging Library)
Let’s see how to set up these libraries under a Leopard / Intel environment.
This library is required for PyCAPTCHA, as far as I know it is already installed with the SDK, to check the directory where the library is installed use the command:
A version of this library should appear under
Download jpeg source and uncompress it in any directory, e.g. ~/jpeg-6b then:
Edit Makefile and change the following line from:
Finally, build and install:
Download PIL source and uncompress it in any directory, e.g.
Edit setup.py and change the following lines from:
to (note that I’m using the FreeType2 directory discovered previously with the locate command):
and then following line from:
Locate these lines:
And add the following lines (correctly indented from column 0):
Now proceed to compile and install the library:
Now you are ready to build and install PyCAPTCHA. Checkout the source code from this link and run the following command: