簡體   English   中英

安裝pandas的問題:“命令'llvm-gcc-4.2'失敗,退出狀態為1”

[英]Issues installing pandas: “command 'llvm-gcc-4.2' failed with exit status 1”

我想用Python 2.7和“sudo pip install pandas”在MAC OS X 10.7上安裝pandas。 我得到的一些輸出:

Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pandas/index.c -o build/temp.macosx-10.7-intel-2.7/pandas/index.o
    In file included from pandas/index.c:317:
    pandas/src/numpy_helper.h: In function ‘infer_type’:
    pandas/src/numpy_helper.h:32: error: ‘PyDatetimeArrType_Type’ undeclared (first use in this function)
    pandas/src/numpy_helper.h:32: error: (Each undeclared identifier is reported only once
    pandas/src/numpy_helper.h:32: error: for each function it appears in.)
    pandas/src/numpy_helper.h: In function ‘get_datetime64_value’:
    pandas/src/numpy_helper.h:53: error: ‘PyDatetimeScalarObject’ undeclared (first use in this function)
    pandas/src/numpy_helper.h:53: error: expected expression before ‘)’ token
    pandas/src/numpy_helper.h: In function ‘is_datetime64_object’:
    pandas/src/numpy_helper.h:84: error: ‘PyDatetimeArrType_Type’ undeclared (first use in this function)
    pandas/src/numpy_helper.h: In function ‘is_timedelta64_object’:
    pandas/src/numpy_helper.h:89: error: ‘PyTimedeltaArrType_Type’ undeclared (first use in this function) 

我得到了這個:

lipo: can't open input file: /var/tmp//ccaW8SVp.out (No such file or directory)

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

所有的依賴項(NumPy,pythondateutil,pytz)都運行正常。 我還提供了最新版本的Command Line Tools,如下所示: 為什么我收到錯誤:命令'llvm-gcc-4.2'失敗,退出狀態為1 ,此處gcc-4.2失敗,退出狀態為1

我認為我的問題與這個(沒有幫助)帖子密切相關: 在MAC中在python中安裝pandas的問題

現在我沒有選擇,真的不知道該怎么做:-(除了尋求幫助...所以提前謝謝!

對我來說,以下修正了它:

sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/
sudo pip install --upgrade numpy
sudo pip install pandas

我注意到Pandas試圖鏈接到Frameworks下的舊版numpy,而不是/Library/Python/2.7/site-packages下的新版本

設置需要一些時間,但我發現MacPorts在安裝第三方模塊時非常有用。 根據我的經驗,它有比Homebrew更多的可用軟件包,而且安裝依賴項的工作要比自己嘗試自己做的少得多。 查看快速入門以了解如何安裝。

安裝完成后,重新啟動終端會話,並檢查PATHecho $PATH )以確保/opt/local/bin位於/usr/bin/Library/Frameworks/Python.framework/Versions/2.7/bin 然后,您可以運行sudo port install py27-pandassudo port install py27-pandas Python和所有依賴項。

安裝MacPorts的缺點是,使用python.org版本的Python安裝的任何軟件包都不可用。 最簡單的方法是使用MacPorts重新安裝它們,或者如果它們不能用作端口,則使用MacPorts版本的pip

祝好運!

更新:我終於設法安裝它(在其他人的幫助下我應該添加......!)。 我不確定我是否記得我所做的一切都是正確而廣泛的,但這里有一些指示:

我認為關鍵是你擁有的numpy版本應該=> 1.6才能讓pandas能夠正確安裝。 但是,Apple提供的默認Python安裝僅允許numpy達到1.5.1版本。 可能是,順便說一下,為什么大熊貓不喜歡Mac OS X提供的Python有更多或其他原因,但重點仍然是你需要另一個Python版本。

所以,我從Python.org下載並安裝了Python 2.7.6版本。

然后你可以“pip install --upgrade numpy”,它將是numpy 1.8。

注意如果'$ which python'給你新的Python.org Python 2.7.6版本,你可能想說'$ python pip install ...'因為第一行pip包含默認的'/ usr / bin / python '所以這將安裝你為“舊的”默認Python版本安裝的任何東西。

請注意,如果您使用它,您還應該升級/重新安裝scipy,因此numpy和scipy版本彼此對應。

我希望這對任何人都有用......!

這很奇怪。

看來OSX的默認python 2.7無法很好地安裝pandas。

我只是安裝python 3.3然后它的工作原理。

pythonbrew開關Python-3.3.1

pip安裝熊貓

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM