与Mac OS X Mavericks安装枕头(10.9.1)

时间:2022-09-19 00:24:33

I'm trying to install Pillow following the instruction:

我正在按照说明安装枕头:

http://pillow.readthedocs.org/en/latest/installation.html#mac-os-x-installation

The issue is that I got error with python -c 'from PIL import Image.

问题是我从PIL导入图像中得到了python -c的错误。

 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

The message says _jpeg_resync_to_restart is not found, I googled to try solve this problem as follows:

消息说没有找到_jpeg_resync_to_restart,我在google上搜索了一下,尝试解决如下问题:

  1. Use brew to install Pillow: https://github.com/Homebrew/homebrew-python
  2. 使用brew安装枕头:https://github.com/Homebrew/homebrew-python
  3. Install libjpeg and install from the source: http://www.thetoryparty.com/2010/08/31/pil-on-snow-leopard-_jpeg_resync_to_restart-error/
  4. 安装libjpeg并从源代码中进行安装:http://www.thetoryparty.com/2010/08/31/pil-on-snow- _jpeg_resync_to_restart-error/

However, nothing works. Is there any way to install Pillow on Mavericks? I use Python 2.7: the default python interpreter.

然而,没有效果。有没有办法在小牛身上安装枕头?我使用Python 2.7:默认的Python解释器。

5 个解决方案

#1


6  

Follow these steps

遵循以下步骤

  1. update xcode on qppstore
  2. 更新xcode qppstore
  3. open the terminal an type:
    1. xcode-select --install
    2. xcode-select——安装
    3. su
    4. export CFLAGS=-Qunused-arguments
    5. 出口CFLAGS = -Qunused-arguments
    6. export CPPFLAGS=-Qunused-arguments
    7. 出口CPPFLAGS = -Qunused-arguments
    8. pip install pillow
    9. pip安装枕头
  4. 打开终端a类型:xcode-select -install su export CFLAGS=-Qunused-arguments export CPPFLAGS=- qunused - qunused -install pip installation pillow

#2


5  

I confirm that following these steps I can install Pillow on Mavericks 10.9.2 with XCode 5

我确认按照以下步骤,我可以在Mavericks 10.9.2上安装带XCode 5的枕头

1:

1:

brew install libtiff libjpeg webp littlecms

2: go to here https://pypi.python.org/pypi/Pillow/2.3.1 downalod the zip file and unzip it.

2:到这里,https://pypi.python.org/pypi/Pillow/2.3.1下拉压缩文件并解压缩。

3: open a Terminal window and go to Pillow-2.3.1 folder in Terminal.

3:打开终端窗口,到终端的Pillow-2.3.1文件夹。

4: these two lines are extremely important because they will ignore the errors during installation of Pillow, without these two lines the setup cannot be finished (I am using python 2.7 so you may need to change whatever version you use):

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: run command

5:运行命令

sudo python setup.py install

Done!

完成了!

#3


3  

a friend told me how to fix this:

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

  1. sudo su -
  2. sudo苏-
  3. export CFLAGS=-Qunused-arguments
  4. 出口CFLAGS = -Qunused-arguments
  5. pip install Image
  6. pip安装映像
  7. python
  8. python
  9. from PIL import Image
  10. 从公益诉讼导入图像

by https://github.com/moskytw

由https://github.com/moskytw

#4


1  

Had this problem in Nov 2015. Easiest solution for me was to install a precompiled binary of pillow using wheels:

在2015年11月有这个问题。对我来说,最简单的解决方案是安装一个预编译的二进制枕头使用*:

pip install wheel
pip install --use-wheel pillow

#5


0  

  1. Reinstall X11 from XQuartz.org
  2. 重新安装X11从XQuartz.org
  3. Install the latest XCode
  4. 安装最新的XCode
  5. Install the command line tools:

    安装命令行工具:

    xcode-select --install

Worked for me on mavericks

在小牛队工作

#1


6  

Follow these steps

遵循以下步骤

  1. update xcode on qppstore
  2. 更新xcode qppstore
  3. open the terminal an type:
    1. xcode-select --install
    2. xcode-select——安装
    3. su
    4. export CFLAGS=-Qunused-arguments
    5. 出口CFLAGS = -Qunused-arguments
    6. export CPPFLAGS=-Qunused-arguments
    7. 出口CPPFLAGS = -Qunused-arguments
    8. pip install pillow
    9. pip安装枕头
  4. 打开终端a类型:xcode-select -install su export CFLAGS=-Qunused-arguments export CPPFLAGS=- qunused - qunused -install pip installation pillow

#2


5  

I confirm that following these steps I can install Pillow on Mavericks 10.9.2 with XCode 5

我确认按照以下步骤,我可以在Mavericks 10.9.2上安装带XCode 5的枕头

1:

1:

brew install libtiff libjpeg webp littlecms

2: go to here https://pypi.python.org/pypi/Pillow/2.3.1 downalod the zip file and unzip it.

2:到这里,https://pypi.python.org/pypi/Pillow/2.3.1下拉压缩文件并解压缩。

3: open a Terminal window and go to Pillow-2.3.1 folder in Terminal.

3:打开终端窗口,到终端的Pillow-2.3.1文件夹。

4: these two lines are extremely important because they will ignore the errors during installation of Pillow, without these two lines the setup cannot be finished (I am using python 2.7 so you may need to change whatever version you use):

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: run command

5:运行命令

sudo python setup.py install

Done!

完成了!

#3


3  

a friend told me how to fix this:

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

  1. sudo su -
  2. sudo苏-
  3. export CFLAGS=-Qunused-arguments
  4. 出口CFLAGS = -Qunused-arguments
  5. pip install Image
  6. pip安装映像
  7. python
  8. python
  9. from PIL import Image
  10. 从公益诉讼导入图像

by https://github.com/moskytw

由https://github.com/moskytw

#4


1  

Had this problem in Nov 2015. Easiest solution for me was to install a precompiled binary of pillow using wheels:

在2015年11月有这个问题。对我来说,最简单的解决方案是安装一个预编译的二进制枕头使用*:

pip install wheel
pip install --use-wheel pillow

#5


0  

  1. Reinstall X11 from XQuartz.org
  2. 重新安装X11从XQuartz.org
  3. Install the latest XCode
  4. 安装最新的XCode
  5. Install the command line tools:

    安装命令行工具:

    xcode-select --install

Worked for me on mavericks

在小牛队工作