Installing Python Imaging Library (PIL) on Snow Leopard with updated Python 2.6.2

前端 未结 12 2182
一向
一向 2020-12-08 01:12

I have a fresh install (started with a wiped drive) of Snow Leopard with the developer tools installed during the Snow Leopard installation.

I then installed Python

相关标签:
12条回答
  • 2020-12-08 01:43

    The python.org Python was built with an earlier gcc. Try using gcc-4.0 instead of SL's default of 4.2:

    export CC=/usr/bin/gcc-4.0
    

    See similar problem here.

    That gets past the stdarg problem. You may then run into later build problems with various dependent libraries.

    BTW, gcc-4.0 and gcc-4.2 are both included with Snow Leopard's Xcode 3 so no additional installs are needed.

    UPDATED 2011-05: Note, that the newer Xcode 4, released for experimental use with 10.6 and expected to be standard with 10.7, no longer includes PPC support so, if you install Xcode 4, this suggestion will not work. Options include using the newer 64-bit/32-bin Python 2.7.x installers from python.org or installing a newer Python 2.6 and PIL and the various 3rd-party libs using MacPorts, Homebrew, or Fink.

    0 讨论(0)
  • 2020-12-08 01:45

    10.6 Snow Leopard install PIL without the hassle and without keeping MacPorts :)

    Step 1: Install MacPorts
    Step 2: sudo port install py26-pil
    Step 3: mv /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/* /Library/Python/2.6/site-packages/
    Step 4: Uninstall MacPorts

    Best of both worlds?

    0 讨论(0)
  • 2020-12-08 01:45

    IT seems to me that the "No such file" is conjunction with stdarg.h is the most interesting error. There seems to be a header file missing. I don't know how to make sure it's installed on OS X, so this only half an answer, sorry about that, but maybe it pushes you in the right direction.

    0 讨论(0)
  • 2020-12-08 01:45

    On OS X Lion with current XCode and no gcc-4.0 I'm able to get around the missing stdard.h error by setting the follow environment variables:

    export CC="/usr/bin/llvm-gcc-4.2"

    I can't say I understand why this works.

    By the way this works for the Pillow fork of PIL too.

    0 讨论(0)
  • 2020-12-08 01:49

    The problem I ran into was that PIL was being compiled against PowerPC architecture (-arch ppc).

    Do this before setup/build/compile:

    export ARCHFLAGS="-arch i386"
    

    (Assuming you're on i386)

    0 讨论(0)
  • 2020-12-08 01:49

    Do you have XCode (comes on the Snow Leopard disc) installed? There are some key components (most notably GCC) that need to be installed which XCode handles for you.

    0 讨论(0)
提交回复
热议问题