错误在Mac OS X上安装Python的Pandas

kev*_*vin 5 python xcode command pip pandas

我想安装pandas以便在Python中使用

我有最新版本的xcode和命令行工具,pip,easy_install,但安装这个一直给我以下错误,任何人都可以帮忙吗?

sudo easy_install pandas

> Best match: pandas 0.13.1
>Downloading https://pypi.python.org/packages/source/p/pandas/pandas-0.13.1.zip#md5=50e4902238dd5312c20c1c85fb024bb6
>Processing pandas-0.13.1.zip
>Running pandas-0.13.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-oU7Yfm/pandas-0.13.1/egg-dist-tmp-I4Mw_P
>warning: no files found matching 'README.rst'  no previously-included directories found matching 'doc/build'
>warning: no previously-included files matching '*.so' found anywhere in distribution
>warning: no previously-included files matching '*.pyd' found anywhere in distribution
>warning: no previously-included files matching '*.pyc' found anywhere in distribution
>warning: no previously-included files matching '.git*' found anywhere in distribution
>warning: no previously-included files matching '.DS_Store' found anywhere in distribution
>warning: no previously-included files matching '*.png' found anywhere in distribution
>clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
>clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
>error: Setup script exited with error: command 'cc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

Ned*_*ily 9

正如评论中所指出的,这是一个现在常见的问题,这是由Xcode 5.1的变化和Apple为系统Python 2.7选择的构建选项引起的.您可以通过删除此处建议的违规选项来解决此问题.如果需要使用sudo(如果使用系统提供的那样easy_install),则还需要确保在sudo环境中定义变量.一种方法是:

sudo bash
umask 022
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
/usr/bin/easy_install pandas
exit
Run Code Online (Sandbox Code Playgroud)

还有其他选项不需要sudo使用virtualenv或使用pip install --user pandas.

更新[2014-05-16]:正如预期的那样,Apple已经使用更新的系统Pythons(2.7,2.6和2.5)OS X 10.9.3解决了这个问题,因此在使用最新的Mavericks时不再需要解决方法Xcode 5.1+.但是,截至目前,OS X 10.8.x如果您在Xcode 5.1+那里使用(Mountain Lion,目前为10.8.5),仍需要解决方法.