我想使用“sudo pip install pandas”在 MAC OS X 10.7 和 Python 2.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)都工作正常。我还有此处建议的最新版本的命令行工具:Why am I getting the error: command 'llvm-gcc-4.2' failed with exit status 1在这里 gcc-4.2 failed with exit status 1
我认为我的问题与此(无帮助)帖子密切相关:Issues with installing pandas in python in MAC
现在我别无选择,真的不知道该怎么做 :-( 除了寻求帮助...所以提前致谢!
最佳答案
对我来说,以下修复了它:
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
下的新版本
关于python - 安装 Pandas 的问题 : "command ' llvm-gcc-4. 2' failed with exit status 1",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20586314/