繁体   English   中英

使用 Mac OS X Mavericks (10.9.1) 安装 Pillow

[英]Installing Pillow with Mac OS X Mavericks (10.9.1)

我正在尝试按照说明安装 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 is not found,我用_jpeg_resync_to_restart搜索尝试解决这个问题,如下所示:

  1. 使用brew安装Pillowhttps : //github.com/Homebrew/homebrew-python
  2. 安装libjpeg并从源码安装: http : //www.thetoryparty.com/2010/08/31/pil-on-snow-leopard-_jpeg_resync_to_restart-error/

但是,没有任何效果。 有没有办法在小牛队上安装枕头? 我使用 Python 2.7:默认的 Python 解释器。

我确认按照这些步骤我可以使用 XCode 5 在 Mavericks 10.9.2 上安装 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

完毕!

按着这些次序

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

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

  1. 须藤 -
  2. 导出 CFLAGS=-Qunused-arguments
  3. pip 安装映像
  4. Python
  5. 从 PIL 导入图像

来自https://github.com/moskytw

在 2015 年 11 月遇到了这个问题。对我来说,最简单的解决方案是使用轮子安装枕头的预编译二进制文件:

pip install wheel
pip install --use-wheel pillow
  1. 从 XQuartz.org 重新安装 X11
  2. 安装最新的 XCode
  3. 安装命令行工具:

    xcode-select --install

在小牛队为我工作

安装早期版本的 Pillow 对我有用

pip uninstall pillow
pip install Pillow==2.5.0

Boom Ya Baby!

from PIL import Image运行 MacOSX 10.8.5 现在不会引发错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM