gpt4 book ai didi

python - 让 django-simple-captcha 工作

转载 作者:行者123 更新时间:2023-12-01 05:56:39 25 4
gpt4 key购买 nike

我正在尝试让简单的验证码与我的 django 一起使用。

完成四个步骤后:

我运行了python manage.py测试验证码。

它给了我这个:

Traceback (most recent call last):
File "/Users/cnnlakshmen_2000/Projects/Permissions/captcha/tests/__init__.py", line 26, in testImages
response = self.client.get(reverse('captcha-image', kwargs=dict(key=key)))
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/test/client.py", line 439, in get
response = super(Client, self).get(path, data=data, **extra)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/test/client.py", line 244, in get
return self.request(**r)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/Users/cnnlakshmen_2000/Projects/Permissions/captcha/views.py", line 27, in captcha_image
font = ImageFont.truetype(settings.CAPTCHA_FONT_PATH, settings.CAPTCHA_FONT_SIZE)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/PIL/ImageFont.py", line 218, in truetype
return FreeTypeFont(filename, size, index, encoding)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/PIL/ImageFont.py", line 134, in __init__
self.font = core.getfont(file, size, index, encoding)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/PIL/ImageFont.py", line 34, in __getattr__
raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed

但我实际上已经安装了 pil。

我输入了 sudo pip install pil,它给了我这个:

Requirement already satisfied (use --upgrade to upgrade): pil in /Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/PIL
Cleaning up...

不确定我的错误在哪里...需要一些指导...

最佳答案

看看_imagingft module not installed

PIL 有许多可选库(FreeType、Jpeg 等),如果缺少这些库,则 PIL 中的某些功能将不可用。

关于python - 让 django-simple-captcha 工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12286250/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com