2012-09-18 201 views
0

我試圖在OSX 10.6.8上使用pip在virtualenv上安裝PIL,但它失敗,gcc返回1退出狀態。pip安裝PIL在OSX上失敗

這裏就是我得到:

$ 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之外的點安裝了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,我得到同樣的警告。

回答

1

您試過枕頭? (pip install pillow):

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

它使生活與PIL容易得多。我能夠通過Pillow在OSX上使用virtualenv和virtualenvwrapper安裝PIL。

+0

嗨,我嘗試了,但不幸的是,我得到了同樣的錯誤:( – DataGreed

+0

在有問題的機器不正確點子安裝其他東西? –

+0

呀,其他的一切我試圖安裝正確,Django的,等等 – DataGreed

0

煤礦安裝細到一個virtualenv中的10.6.8但是......

礦井正在建設中使用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 
+0

好吧,我可以將符號鏈接改爲p oint to gcc-4.0,但這是一個非常醜陋的解決方法(即使它可以工作) – DataGreed

+0

我的gcc符號鏈接指向4.2,如上所示。無論出於何種原因,我的計算機上有一些Python正在閱讀並決定使用4.0來代替。 (已經檢查過env vars) –

+0

有沒有可能你的virtualenv正在使用不同版本的python?也許有問題的機器試圖運行一個Python,並從另一個配置信息,因爲安裝不乾淨。 另外,看看這些關於python一般gcc問題的討論:http://stackoverflow.com/questions/5944228/python-build-using-wrong-version-of-gcc-on-os-x http: //stackoverflow.com/questions/5967065/python-distutils-not-using-correct-version-of-gcc –