我刚刚在我的 virtualenv 中安装了一个 Pillow 包。这样做:
from PIL import Image, ImageFont, ImageDraw
ImageFont.load_path('some_path')
我收到一个错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/net/isilonP/public/rw/homes/cbl_adm/.virtualenvs/chembl_webservices/lib/python2.7/site-packages/PIL/ImageFont.py", line 264, in load_path
if not isinstance(filename, "utf-8"):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
事实上,如果你查看官方 gihub 存储库(https://github.com/python-imaging/Pillow/blob/master/PIL/ImageFont.py#L264),你可以看到这个结构:
if not isinstance(filename, "utf-8"):
...
我的问题是:如何用实际有效的东西替换它?