gpt4 book ai didi

Python psd_工具 : 'module' object has no attribute 'profile_frombytes'

转载 作者:太空宇宙 更新时间:2023-11-03 18:18:49 25 4
gpt4 key购买 nike

运行以下代码:

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

最佳答案

从 Lukas Graf 找到答案。请参阅上面的评论。

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

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

关于Python psd_工具 : 'module' object has no attribute 'profile_frombytes' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24559488/

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