2012-02-01 74 views
2
mac-cordreys-macbook-pro:~ maccordrey$ sudo pip install PIL 
/usr/local/bin/pip:5: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.5/site-packages is being added to sys.path 
    from pkg_resources import load_entry_point 
/usr/local/bin/pip:5: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.pyc, but /Library/Python/2.5/site-packages is being added to sys.path 
    from pkg_resources import load_entry_point 
Downloading/unpacking PIL 
    Running setup.py egg_info for package PIL 
    /Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.5/site-packages is being added to sys.path 
     from pkg_resources import Distribution, PathMetadata, ensure_directory 
    /Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.pyc, but /Library/Python/2.5/site-packages is being added to sys.path 
     from pkg_resources import Distribution, PathMetadata, ensure_directory 
    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 
    /Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.5/site-packages is being added to sys.path 
     from pkg_resources import Distribution, PathMetadata, ensure_directory 
    /Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.pyc, but /Library/Python/2.5/site-packages is being added to sys.path 
     from pkg_resources import Distribution, PathMetadata, ensure_directory 
    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 -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.5/include -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _imaging.c -o build/temp.macosx-10.5-i386-2.5/_imaging.o 
    unable to execute gcc: No such file or directory 
    error: command 'gcc' failed with exit status 1 
    Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/Users/maccordrey/build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-5EOlVp-record/install-record.txt: 
    /Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.5/site-packages is being added to sys.path 

    from pkg_resources import Distribution, PathMetadata, ensure_directory 

/Library/Python/2.5/site-packages/setuptools/command/install_scripts.py:3: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site.pyc, but /Library/Python/2.5/site-packages is being added to sys.path 

    from pkg_resources import Distribution, PathMetadata, ensure_directory 

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 -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.5/include -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _imaging.c -o build/temp.macosx-10.5-i386-2.5/_imaging.o 

unable to execute gcc: No such file or directory 

error: command 'gcc' failed with exit status 1 

---------------------------------------- 
Command /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/Users/maccordrey/build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-5EOlVp-record/install-record.txt failed with error code 1 
Storing complete log in /Users/maccordrey/.pip/pip.log 
mac-cordreys-macbook-pro:~ maccordrey$ 

任何想法?我不確定爲什麼我收到這個錯誤?我剛剛開始使用PIP,但還沒有出現任何問題,是否需要將tar文件移出我的下載文件夾?sudo pip安裝PIL和錯誤代碼1

回答

1

一些Python包需要從源代碼構建。這樣做需要gcc,它在OS X上由XCode提供。如果你沒有安裝XCode,install it它應該解決這個問題。

5

您需要安裝gcc編譯器才能構建PIL。使用系統包安裝PIL會更好。例如在Ubuntu中,您必須運行sudo apt-get install python-imaging

在OSX上嘗試安裝Homebrew並運行brew install pil

+0

OS X沒有內置的包管理器。 – Amber 2012-02-01 07:56:13

+0

另外,Homebrew要求無論如何都要安裝XCode,所以它只是毫無意義的絨毛。 – Amber 2012-02-01 07:58:10

+0

這不是毫無意義的,因爲自制軟件會處理所有的依賴關係(如果有的話)。 – 2012-02-01 08:14:31

0

您需要安裝XCode才能安裝gcc,這就是您所缺少的。