目前,由於gcc-4.0錯誤,我無法安裝任何Python軟件包。我會複製我得到了錯誤的兩個例子(一個PIP,對方用手動setup.py構建/安裝方法):OSX:安裝python軟件包時出錯
sgarza62$ 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.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.3-fat-2.7/_imaging.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/var/folders/9q/bvqtzkbx1hg1934b36zgk0y40000gp/T/pip-build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9q/bvqtzkbx1hg1934b36zgk0y40000gp/T/pip-nV9YEx-record/install-record.txt --single-version-externally-managed:
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.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.3-fat-2.7/_imaging.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
sgarza62$ cd Imaging-1.1.7
sgarza62$ sudo python setup.py build
running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.3-fat-2.7/_imaging.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
這裏有一堆信息,我會從終端複製,希望其中的一些有助於確定問題:
sgarza62$ gcc
i686-apple-darwin11-llvm-gcc-4.2: no input files
sgarza62$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:32:06)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
sgarza62$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
sgarza62$ echo $PATH
/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
sgarza62$ /usr/bin/python -c 'import sys;print(sys.version)'
2.7.2 (default, Jun 16 2012, 12:38:40)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
sgarza62$ /usr/bin/python2.6 -c 'import sys; print(sys.version)'
2.6.7 (r267:88850, Jun 16 2012, 12:38:45)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
sgarza62$ /usr/bin/python2.5 -c 'import sys;print(sys.version)'
2.5.6 (r256:88840, Jun 16 2012, 12:38:24)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
sgarza62$ /usr/bin/python2.7 -c 'import sys;print(sys.version)'
2.7.2 (default, Jun 16 2012, 12:38:40)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
這裏有一些問題/一個在堆棧上解決相同或類似問題(但沒有提供我的問題的完整解決方案)的nswers。也許這些以前的答案將是使用搞清楚這個問題:
Reinstalling python on Mac OS 10.6 with a different gcc version
How to use/install gcc on Mac OS X 10.8/Xcode 4.4
Python build using wrong version of GCC on OS X
這是我已經做過的事情,這已經建議堆棧用戶出現類似問題:
下載Xcode的
安裝命令行工具在Xcode的喜好
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
我已經做了我的問題,最好給儘可能多的事實,儘可能以清晰有序的方式。但是,如果你們需要更多信息,請詢問!我會很樂意編輯更多細節的問題。
此外,我知道這似乎是一個非常具體的問題,但從四處搜尋,看起來像很多人都對這個問題感到困惑。
如果你不介意的話,我會非常感謝一個勺子餵食的解決方案(明確說明我在終端中必須做什麼來解決這個問題)。我在終端上還不是很舒服,並且對一般化的答案有些困惑。
謝謝大家的時間,我欣賞它!
Ned,您似乎是與gcc,Python,Xcode和Python包相關的問題的權威人士。你介意看看這個問題,讓我知道你是否可以幫忙?我一直堅持這個問題好幾天,沒有其他人的解決方案爲我工作:http://stackoverflow.com/q/15795757/1337422 – sgarza62