python - 安装 Pandas 的问题 : "command ' llvm-gcc-4. 2' failed with exit status 1"

标签 python macos gcc numpy pandas

我想使用“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/

相关文章:

python - append Python 3D Numpy 数组

python - 即使使用分页搜索,OpenLDAP 也不会搜索超过 500 个条目

python - 我应该将编码 ='utf-8' 添加到我的 Python 日志记录处理程序吗?

macos - 适用于 Mac OSX 的串行端口模拟器

python - 在 Mac 10.6 上为 GAE/Django-nonrel 安装 Python 2.5(我是一个新的 Mac 用户)

c++ - std::string 复制构造函数在 GCC 4.1.2 中不是很深?

python - 一起替换多个正则表达式模式

macos - 如何检查 PostgreSQL 服务器 Mac OS X 的状态

c - 关于 GCC 优化器的问题以及为什么这段代码总是返回 42?

c - gcc 中的 arm 内联汇编