我想安装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
答案 0 :(得分:9)
正如评论中所指出的,这是一个现在常见的问题,这是由Xcode 5.1的变化和Apple对系统Python 2.7的构建选项的选择引起的。您可以按照建议here删除违规选项来解决此问题。如果您需要使用sudo
(如果您使用系统提供的easy_install
,则可能使用),您还需要确保在sudo
环境中定义变量。一种方法是:
sudo bash
umask 022
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
/usr/bin/easy_install pandas
exit
还有其他选项不需要sudo
,例如使用virtualenv
或使用pip install --user pandas
。
更新[2014-05-16]:正如预期的那样,Apple已经使用OS X 10.9.3
中更新的系统Pythons(2.7,2.6和2.5)解决了这个问题,因此在使用最新的Mavericks时不再需要解决方法和Xcode 5.1+
。但是,截至目前,如果您在OS X 10.8.x
使用Xcode 5.1+
,则{{1}}(Mountain Lion,目前为10.8.5)仍需要解决方法。