簡體   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