Reputation: 1153
I'm trying to use the Django-simple-captcha http://django-simple-captcha.readthedocs.org/en/latest/usage.html in my django app. But the captcha image is not showing up in the templates. I get the following error when I viewed the source code in my browser. I've followed the documenation carefully and have syncdb everything.
Traceback:
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
114. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Library/Python/2.7/site-packages/captcha/views.py" in captcha_image
46. font = ImageFont.truetype(settings.CAPTCHA_FONT_PATH, settings.CAPTCHA_FONT_SIZE * scale)
File "/Library/Python/2.7/site-packages/PIL/ImageFont.py" in truetype
228. return FreeTypeFont(font, size, index, encoding)
File "/Library/Python/2.7/site-packages/PIL/ImageFont.py" in __init__
131. self.font = core.getfont(font, size, index, encoding)
File "/Library/Python/2.7/site-packages/PIL/ImageFont.py" in __getattr__
42. raise ImportError("The _imagingft C module is not installed")
Exception Type: ImportError at /captcha/image/f02c7bf84cd31c4caf8d6b2f8931a01689902c83/
Exception Value: The _imagingft C module is not installed
I know that this question has been asked several times before and I've read several stackoverflow answers but I'm still very confused about the course of action.
I've Pillow installed on my OSX Mavericks.
Upvotes: 0
Views: 3633
Reputation: 4150
Works for me in ubuntu 14.04:
pip uninstall pil
or(depends what you are using)
pip uninstall pillow
then
sudo apt-get update
apt-get install libfreetype6-dev libxft-dev libjpeg62 libjpeg-devel
in the output, make sure the installation was complete
And finnaly
pip install pil
or
pip install pillow
Upvotes: 0
Reputation: 27969
I solved the above error by installing freetype and freetype2 devel packages before running pip install Pillow
.
Worked on SuSE Linux.
Upvotes: 1