Ubuntu 13.10 下 Python2.7版 PIL 的一个bug修复

报错为:

Traceback (most recent call last):
  File "twrp_font3.py", line 43, in <module>
    text.text(((width_en-text_size[0])/2,y_en), en[i], 255, font_en)
  File "/usr/lib/python2.7/dist-packages/PIL/ImageDraw.py", line 256, in text
    ink, fill = self._getink(fill)
  File "/usr/lib/python2.7/dist-packages/PIL/ImageDraw.py", line 144, in _getink
    if self.palette and not Image.isNumberType(ink):
AttributeError: 'module' object has no attribute 'isNumberType'

解决方法,参考这个网址:

https://github.com/jj1bdx/wspr/tree/master/FIX-Ubuntu-13.04


将上面的ImageDraw.py替换原来的即可:

https://github.com/python-imaging/Pillow/blob/1f41e25b4feec620ad32e8b3a9b28466f63b3afe/PIL/ImageDraw.py


替换到 下面的目录下, 注意修改权限为644,

同时要将该目录下的ImageDraw.pyc删除

/usr/lib/python2.7/dist-packages/PIL/

你可能感兴趣的:(Ubuntu 13.10 下 Python2.7版 PIL 的一个bug修复)