【问题标题】:pip install PIL fails on OSXpip install PIL 在 OSX 上失败
【发布时间】:2012-09-18 16:51:06
【问题描述】:

我正在尝试使用 virtualenv 中的 pip 在 OSX 10.6.8 上安装 PIL,但它失败,gcc 返回 1 个退出状态。

这是我得到的:

$ pip install PIL
Downloading/unpacking PIL
  Running setup.py egg_info for package PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py
Installing collected packages: PIL
  Running setup.py install for PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py
    --- using frameworks at /System/Library/Frameworks
    building '_imaging' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/opt/local/include/freetype2 -IlibImaging -I/opt/local/include -I/Users/DataGreed/workspaces/vitrualenv/project/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o
    _imaging.c:3017: warning: initialization from incompatible pointer type
    _imaging.c:3077: warning: initialization from incompatible pointer type
    /usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/as/ppc/as or /usr/bin/../local/libexec/as/ppc/as) for architecture ppc not installed
    Installed assemblers are:
    /usr/bin/../libexec/as/x86_64/as for architecture x86_64
    /usr/bin/../libexec/as/i386/as for architecture i386
    /usr/bin/../libexec/as/arm/as for architecture arm
    _imaging.c:3017: warning: initialization from incompatible pointer type
    _imaging.c:3077: warning: initialization from incompatible pointer type
    _imaging.c:3281: fatal error: error writing to -: Broken pipe
    compilation terminated.
    _imaging.c:3017: warning: initialization from incompatible pointer type
    _imaging.c:3077: warning: initialization from incompatible pointer type
    lipo: can't open input file: /var/folders/sO/sODPLYP7Goy5NCFskrL1dE+++TM/-Tmp-//ccds0vgZ.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /Users/DataGreed/workspaces/vitrualenv/project/bin/python -c "import setuptools;__file__='/Users/DataGreed/workspaces/vitrualenv/project/build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/sO/sODPLYP7Goy5NCFskrL1dE+++TM/-Tmp-/pip-BNAuaC-record/install-record.txt --single-version-externally-managed --install-headers /Users/DataGreed/workspaces/vitrualenv/project/bin/../include/site/python2.6:
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py

running install

running build

running build_py

running build_ext

--- using frameworks at /System/Library/Frameworks

building '_imaging' extension

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/opt/local/include/freetype2 -IlibImaging -I/opt/local/include -I/Users/DataGreed/workspaces/vitrualenv/project/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o

_imaging.c:3017: warning: initialization from incompatible pointer type

_imaging.c:3077: warning: initialization from incompatible pointer type

/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/as/ppc/as or /usr/bin/../local/libexec/as/ppc/as) for architecture ppc not installed

Installed assemblers are:

/usr/bin/../libexec/as/x86_64/as for architecture x86_64

/usr/bin/../libexec/as/i386/as for architecture i386

/usr/bin/../libexec/as/arm/as for architecture arm

_imaging.c:3017: warning: initialization from incompatible pointer type

_imaging.c:3077: warning: initialization from incompatible pointer type

_imaging.c:3281: fatal error: error writing to -: Broken pipe

compilation terminated.

_imaging.c:3017: warning: initialization from incompatible pointer type

_imaging.c:3077: warning: initialization from incompatible pointer type

lipo: can't open input file: /var/folders/sO/sODPLYP7Goy5NCFskrL1dE+++TM/-Tmp-//ccds0vgZ.out (No such file or directory)

error: command 'gcc-4.2' failed with exit status 1

UPD: 在另一台计算机上安装完美无瑕的 osx 版本:-/

UPD2:其实还有更奇怪的事情。我已经通过 virtualenv 外部的 pip 安装了 PIL。但我不能只在 virtualenv 中安装它。

UPD3:我不知道它是否有帮助,但是当我加载 virtualenv 包装脚本时,我得到了这个:

/Library/Python/2.6/site-packages/stevedore/extension.py:4: UserWarning: Module 

pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
  import pkg_resources
/Library/Python/2.6/site-packages/stevedore/extension.py:4: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
  import pkg_resources

当我使用workon 时,我会收到相同的警告。

【问题讨论】:

    标签: python installation python-imaging-library pip


    【解决方案1】:

    你试过枕头吗? (pip install pillow):

    http://pypi.python.org/pypi/Pillow/

    它让 PIL 的生活变得更加轻松。我能够通过 Pillow 在 OSX 上使用 virtualenv 和 virtualenvwrapper 安装 PIL。

    【讨论】:

    • 在有问题的机器上 pip 是否正确安装了其他东西?
    • 是的,我尝试过的其他所有东西都安装正确,django 等等。
    • XCode 和命令行工具是最新的并且与工作机器上的版本匹配?
    • 你看,其实还有更奇怪的事情。我已经在 virtualenv 之外安装了 PIL vie pip。但我不能只在 virtualenv 中安装它。
    • 这两个系统的 $PATH 是否存在巨大差异? (只看python相关的组件)。
    【解决方案2】:

    我的在 10.6.8 上可以很好地安装到 virtualenv 但是...

    我的是用 gcc-4.0 构建的,而你的是用 4.2 构建的;而 4.2 应该是默认的。

    所以我实际上不知道为什么我的使用 gcc-4.0 构建,但它确实工作正常。

    $ which gcc
    /usr/bin/gcc
    $ ls -alh /usr/bin/gcc
    lrwxr-xr-x  1 root  wheel     7B Jan  3  2012 /usr/bin/gcc -> gcc-4.2
    

    【讨论】:

    • 好吧,我可能可以将符号链接更改为指向 gcc-4.0,但这是一个非常丑陋的解决方法(即使它会起作用)
    • 我的 gcc 符号链接指向 4.2 ,如上所示。无论出于何种原因,我的计算机上都有一些 Python 正在读取并决定使用 4.0 的东西。 (已经检查了环境变量)
    • 您的 virtualenv 是否有可能使用不同版本的 python ?也许有问题的机器正在尝试使用来自另一台的配置信息运行一个 Python,因为安装不干净。另外,看看这些关于 python 的一般 gcc 问题的讨论:stackoverflow.com/questions/5944228/…stackoverflow.com/questions/5967065/…
    • 谢谢。刚刚检查:两个虚拟环境。和系统环境使用 Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49);尝试了 gcc-4.0,但没有运气:同样的错误 :(
    • 我没有想法了 :( 祝你好运,如果你找到解决办法,请告诉我们。
    猜你喜欢
    • 2015-12-22
    • 1970-01-01
    • 2018-07-06
    • 1970-01-01
    • 1970-01-01
    • 2017-05-18
    • 2022-01-16
    • 2018-09-24
    • 1970-01-01
    相关资源
    最近更新 更多