用Mac OS X Mavericks安装Pillow (10.9.1)

问题描述 投票:5回答:6

我试图安装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 是找不到的,我上网尝试解决这个问题,如下。

  1. 使用 brew 安装 Pillow: https:/github.comHomebrewhomebrew-python。
  2. 安装libjpeg,从源头安装。http:/www.thetoryparty.com20100831pil-on-snow-leopard-_jpeg_resync_to_restart-error

但是,什么都不能用。有什么办法可以在Mavericks上安装Pillow吗?我使用Python 2.7:默认的python解释器。

python macos python-imaging-library osx-mavericks pillow
6个回答
7
投票

我确认按照这些步骤,我可以在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

完成!


6
投票

按照以下步骤

  1. 在qppstore上更新xcode
  2. 打开终端,输入。
    1. xcode-select --install
    2. su
    3. export CFLAGS=-Qunused-arguments
    4. export CPPFLAGS=-Qunused-arguments
    5. pip install pillow

3
投票

一个朋友告诉我如何解决这个问题。

  1. sudo su -
  2. 导出CFLAGS=-Qunused-arguments。
  3. pip install Image
  4. 蟒蛇
  5. 从PIL导入Image

https:/github.commoskytw。


1
投票

2015年11月就遇到了这个问题。对我来说,最简单的解决方法是使用wars安装枕头的预编译二进制。

pip install wheel
pip install --use-wheel pillow

0
投票
  1. 从XQuartz.org重新安装X11。
  2. 安装最新的XCode
  3. 安装命令行工具。

    xcode-select --install

在小牛上为我工作


0
投票

安装早期版本的Pillow对我来说是有效的。

pip uninstall pillow
pip install Pillow==2.5.0

Boom Ya Baby!

运行MacOSX 10.8.5 from PIL import Image 现在没有出现任何错误。

© www.soinside.com 2019 - 2024. All rights reserved.