django-simple-captcha can't show captcha on my computer.
when I run python manage.py test captcha,I got the errors as follow:
django-simple-captcha无法在我的计算机上显示验证码。当我运行python manage.py test captcha时,我得到的错误如下:
python manage.py test captcha
Creating test database for alias 'default'...
.E...E..........
======================================================================
ERROR: testContentLength (captcha.tests.CaptchaCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/captcha/tests/__init__.py", line 179, in testContentLength
response = self.client.get(reverse('captcha-image', kwargs=dict(key=key)))
File "/Library/Python/2.7/site-packages/django/test/client.py", line 453, in get
response = super(Client, self).get(path, data=data, **extra)
File "/Library/Python/2.7/site-packages/django/test/client.py", line 279, in get
return self.request(**r)
File "/Library/Python/2.7/site-packages/django/test/client.py", line 424, in request
six.reraise(*exc_info)
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/Library/Python/2.7/site-packages/captcha/views.py", line 80, in captcha_image
image.save(out, "PNG")
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 1467, in save
save_handler(self, fp, filename)
File "/Library/Python/2.7/site-packages/PIL/PngImagePlugin.py", line 605, in _save
ImageFile._save(im, _idat(fp, chunk), [("zip", (0,0)+im.size, 0, rawmode)])
File "/Library/Python/2.7/site-packages/PIL/ImageFile.py", line 452, in _save
e = Image._getencoder(im.mode, e, a, im.encoderconfig)
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 395, in _getencoder
return encoder(mode, *args + extra)
TypeError: function takes at most 4 arguments (6 given)
======================================================================
ERROR: testImages (captcha.tests.CaptchaCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/captcha/tests/__init__.py", line 30, in testImages
response = self.client.get(reverse('captcha-image', kwargs=dict(key=key)))
File "/Library/Python/2.7/site-packages/django/test/client.py", line 453, in get
response = super(Client, self).get(path, data=data, **extra)
File "/Library/Python/2.7/site-packages/django/test/client.py", line 279, in get
return self.request(**r)
File "/Library/Python/2.7/site-packages/django/test/client.py", line 424, in request
six.reraise(*exc_info)
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/Library/Python/2.7/site-packages/captcha/views.py", line 80, in captcha_image
image.save(out, "PNG")
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 1467, in save
save_handler(self, fp, filename)
File "/Library/Python/2.7/site-packages/PIL/PngImagePlugin.py", line 605, in _save
ImageFile._save(im, _idat(fp, chunk), [("zip", (0,0)+im.size, 0, rawmode)])
File "/Library/Python/2.7/site-packages/PIL/ImageFile.py", line 452, in _save
e = Image._getencoder(im.mode, e, a, im.encoderconfig)
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 395, in _getencoder
return encoder(mode, *args + extra)
TypeError: function takes at most 4 arguments (6 given)
----------------------------------------------------------------------
Ran 16 tests in 0.543s
FAILED (errors=2)
Destroying test database for alias 'default'...
i have installed pil.
我已经安装了pil。
I have no idea what happend in this case,Please help! thank you!
我不知道在这种情况下发生了什么,请帮忙!谢谢!
1 个解决方案
#1
4
This happens when both PIL
and Pillow
installed.
安装PIL和Pillow时会发生这种情况。
Try this command, it helps me:
试试这个命令,它可以帮助我:
pip uninstall PIL
pip uninstall Pillow
pip install Pillow
In other words, uninstall PIL
and re-install Pillow
.
换句话说,卸载PIL并重新安装Pillow。
#1
4
This happens when both PIL
and Pillow
installed.
安装PIL和Pillow时会发生这种情况。
Try this command, it helps me:
试试这个命令,它可以帮助我:
pip uninstall PIL
pip uninstall Pillow
pip install Pillow
In other words, uninstall PIL
and re-install Pillow
.
换句话说,卸载PIL并重新安装Pillow。