安装pandas的问题:"命令'llvm-gcc-4.2'失败,退出状态为1"

los*_*pos 4 python macos gcc numpy pandas

我想用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) 
Run Code Online (Sandbox Code Playgroud)

我得到了这个:

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
Run Code Online (Sandbox Code Playgroud)

所有的依赖项(NumPy,pythondateutil,pytz)都运行正常.我还提供了最新版本的Command Line Tools,如下所示:为什么我收到错误:命令'llvm-gcc-4.2'失败,退出状态为1,此处gcc-4.2失败,退出状态为1

我认为我的问题与这个(没有帮助)帖子密切相关:在MAC中在python中安装pandas的问题

现在我没有选择,真的不知道该怎么做:-(除了寻求帮助...所以提前谢谢!

小智 6

对我来说,以下修正了它:

sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/
sudo pip install --upgrade numpy
sudo pip install pandas
Run Code Online (Sandbox Code Playgroud)

我注意到,熊猫试图将旧版本的numpy链接起来Frameworks,而不是更新的版本/Library/Python/2.7/site-packages