我试图安装Pillow按照指示。
http://pillow.readthedocs.org/en/latest/installation.html#mac-os-x-installation
问题是我收到了错误信息 python -c 'from PIL import Image
.
python -c "from PIL import Image"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 53, in <module>
from PIL import _imaging as core
ImportError: dlopen(/Library/Python/2.7/site-packages/PIL/_imaging.so, 2):
Symbol not found: _jpeg_resync_to_restart
Referenced from: /Library/Python/2.7/site-packages/PIL/_imaging.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/PIL/_imaging.so
消息说 _jpeg_resync_to_restart
是找不到的,我上网尝试解决这个问题,如下。
brew
安装 Pillow
: https:/github.comHomebrewhomebrew-python。但是,什么都不能用。有什么办法可以在Mavericks上安装Pillow吗?我使用Python 2.7:默认的python解释器。
我确认按照这些步骤,我可以在Mavericks 10.9.2和XCode 5上安装Pillow。
1:
brew install libtiff libjpeg webp littlecms
2: 到这里来 https://pypi.python.org/pypi/Pillow/2.3.1
下载zip文件并解压。
3:打开终端窗口,进入终端中的Pillow-2.3.1文件夹。
4:这两行是非常重要的,因为它们会忽略Pillow安装过程中的错误,如果没有这两行,安装就无法完成(我使用的是python 2.7,所以你可能需要改变你使用的任何版本)。
sudo sed -i '' -e 's/-mno-fused-madd//g' /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py
sudo rm /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.pyc
5: 运行命令
sudo python setup.py install
完成!
按照以下步骤
xcode-select --install
su
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
pip install pillow
一个朋友告诉我如何解决这个问题。
2015年11月就遇到了这个问题。对我来说,最简单的解决方法是使用wars安装枕头的预编译二进制。
pip install wheel
pip install --use-wheel pillow
安装命令行工具。
在小牛上为我工作
安装早期版本的Pillow对我来说是有效的。
pip uninstall pillow
pip install Pillow==2.5.0
Boom Ya Baby!
运行MacOSX 10.8.5 from PIL import Image
现在没有出现任何错误。