我已经使用PSD-TOOLS在13英寸笔记本电脑上使用半年了(Python 2.7.3)。只是尝试在运行10.8.4的Mac上进行全新安装。
我在http://docs.python-guide.org/en/latest/starting/install/osx/(Python版本
)上运行了python设置使用以下方式安装Pil:
sudo pip install pil
我所有的Pil脚本都运行正常。
pip list
显示PIL(1.1.7)安装正常。
然后尝试使用:
安装psd-toolssudo pip install psd-tools
似乎安装正常,但是当我运行我的PSD脚本时,请获取以下内容:
File "/Library/Python/2.7/site-packages/psd_tools/user_api/psd_image.py", line 91, in as_PIL
return self._psd._layer_as_PIL(self._index)
File "/Library/Python/2.7/site-packages/psd_tools/user_api/psd_image.py", line 243, in _layer_as_PIL
return pil_support.extract_layer_image(self.decoded_data, index)
File "/Library/Python/2.7/site-packages/psd_tools/user_api/pil_support.py", line 32, in extract_layer_image
decoded_data.header.depth, get_icc_profile(decoded_data))
File "/Library/Python/2.7/site-packages/psd_tools/user_api/pil_support.py", line 68, in _channels_data_to_PIL
raise Exception("This module requires PIL (or Pillow) installed.")
Exception: This module requires PIL (or Pillow) installed.
有人遇到过这个问题吗?
答案 0 :(得分:1)
我使用OSX 10.9
在Python 2.7.5
上遇到了此问题。 (在virtualenv中)
我最终翻过https://pypi.python.org/pypi/Pillow/2.2.1并为Pillow安装了一些可选的先决条件。
#I already had libjpeg but this is the line in their doc.
brew install libtiff libjpeg webp littlecms
#Then re-installed Pillow
pip install --force-reinstall --upgrade pillow
结果是启用了以下功能
--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- TIFF G3/G4 (experimental) support available
*** FREETYPE2 support not available
--- LITTLECMS support available
--- WEBP support available
--- WEBPMUX support available
我的小蟒蛇测试跑了
from PIL import Image
from psd_tools import PSDImage
psd = PSDImage.load('test_data/1.psd')
merged_image = psd.as_PIL()
不确定哪些要求是负责任的,所以如果您不想安装额外的库,您可能需要一次做1个或深入挖掘源。