Python psd_tools:'module'对象没有属性'profile_frombytes'

时间:2014-07-03 17:00:49

标签: python macos python-imaging-library pillow

运行以下代码:

from PIL import *
from psd_tools import *
psd = PSDImage.load('test.psd')

我收到此错误:

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    psd = PSDImage.load('test.psd')
  File "/Library/Python/2.7/site-packages/psd_tools/user_api/psd_image.py", line 192, in load
    return cls.from_stream(fp, encoding)
  File "/Library/Python/2.7/site-packages/psd_tools/user_api/psd_image.py", line 200, in from_stream
    psd_tools.reader.parse(fp, encoding)
  File "/Library/Python/2.7/site-packages/psd_tools/decoder/decoder.py", line 30, in parse
    image_resource_blocks = image_resources.decode(reader_parse_result.image_resource_blocks),
  File "/Library/Python/2.7/site-packages/psd_tools/decoder/image_resources.py", line 58, in decode
    return [parse_image_resource(res) for res in image_resource_blocks]
  File "/Library/Python/2.7/site-packages/psd_tools/decoder/image_resources.py", line 68, in parse_image_resource
    return resource._replace(data = decoder(resource.data))
  File "/Library/Python/2.7/site-packages/psd_tools/decoder/image_resources.py", line 141, in _decode_icc
    return ImageCms.ImageCmsProfile(io.BytesIO(data))
  File "/Library/Python/2.7/site-packages/PIL/ImageCms.py", line 158, in __init__
    self._set(core.profile_frombytes(profile.read()))
AttributeError: 'module' object has no attribute 'profile_frombytes'

我已采取措施重新安装PIL,Pillow,psd-tools和依赖项。

我无法深究这一点。

在Mac OSX 10.7.5上运行Python 2.7

编辑: 这是请求的输出 -

/Library/Python/2.7/site-packages/PIL/_imagingcms.so:
    /usr/local/lib/liblcms.1.0.19.dylib (compatibility version 2.0.0, current version 2.19.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

枕头版: 2.5.0

1 个答案:

答案 0 :(得分:1)

从Lukas Graf找到答案。见上面的评论。

小CMS需要更新到最新版本。

$ brew install little-cms2
$ pip uninstall pillow
$ pip install pillow