2011-12-18 56 views
4

我也跟着下面的步驟:如何在OSX安裝psycopg2 10.7

1)$ sudo pip install psycopg2

這給了我下面的錯誤

Downloading/unpacking psycopg2 
    Running setup.py egg_info for package psycopg2 

    no previously-included directories found matching 'doc/src/_build' 
Installing collected packages: psycopg2 
    Running setup.py install for psycopg2 
    building 'psycopg2._psycopg' extension 
    llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.3 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090004 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.7-intel-2.7/psycopg/psycopgmodule.o 
    unable to execute llvm-gcc-4.2: No such file or directory 
    error: command 'llvm-gcc-4.2' failed with exit status 1 
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/Users/boltellinfomedia/mukul/mukul/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-8NaS72-record/install-record.txt: 
    running install 

running build 

running build_py 

running build_ext 

building 'psycopg2._psycopg' extension 

llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.3 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090004 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.7-intel-2.7/psycopg/psycopgmodule.o 

unable to execute llvm-gcc-4.2: No such file or directory 

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

---------------------------------------- 
Command /usr/bin/python -c "import setuptools;__file__='/Users/boltellinfomedia/mukul/mukul/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-8NaS72-record/install-record.txt failed with error code 1 
Storing complete log in /Users/boltellinfomedia/.pip/pip.log 

2)然後我搜索Web的安裝LLVM -gcc-4.2從此http://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-llvm-gcc/_index.html 得知我需要安裝Xcode

也是從這個psycopg2 installation problem on OSX Lion我開始知道我可以通過macports安裝psycopg2,但是隨後從此http://www.macports.org/install.php開始知道我需要再次使用xcode。

3)最後我試着從蘋果商店安裝Xcode,它下載了1.6 GB的文件,之後說它現在已經安裝在我的系統上。這裏是相同

截圖![MacPorts的安裝圖像] [1]

4),然後我試圖通過在http://www.macports.org/install.php提供的dmg文件來安裝的MacPorts但它說,Xcode中尚未安裝在我的系統。以下是相同的截圖。 ![試圖安裝macport,xcode未安裝消息出現] [2]

+0

我無法添加圖片,因爲我沒有10點聲望點。一旦我贏得了他們,我將添加圖像。 – mukul 2011-12-18 23:41:47

回答

2

問題最有可能的是,您只從App Store下載Xcode INSTALLER。您現在需要運行安裝程序來安裝Xcode。

+0

謝謝你給予你的時間。我無法附加圖片,否則我會告訴你,蘋果商店說,Xcode已安裝。沒有鏈接重新安裝或卸載,我該如何調試此問題。 – mukul 2011-12-19 03:50:04

+0

這裏是圖像的鏈接http://imageshack.us/photo/my-images/213/screenshot20111219at443.png/ – mukul 2011-12-19 04:16:31

+0

正如你所說,我發現安裝程序文件只被下載,並沒有安裝。我終於能夠找到安裝它的鏈接。雖然這很奇怪,即使應用程序沒有安裝,蘋果商店顯示它已安裝。最後,一切都在你的幫助下解決。 – mukul 2011-12-19 09:00:38

3

這裏還有一個額外的細節。在Xcode 4.3及更高版本中,您需要將命令行工具作爲單獨的步驟安裝。您需要這樣做才能使腳本啓動對命令行版本的調用llvm-gcc-4.2

轉至Xcode>首選項>下載>命令行工具安裝。

+1

謝謝。這幫助我在升級到Mountain Lion後重新安裝Python 2.7時解決了「無法執行叮鐺聲」問題。 – Tom 2012-07-25 19:18:10

+0

我已經2小時編輯我的bash並嘗試各種黑客了。這解決了它。 – Gazzini 2012-10-11 05:38:41