繁体   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