2014-03-27 81 views
33

与其他许多人一样,我在安装python库(以tar下载,然后解压缩)时遇到问题。“'cc'失败,退出状态1”安装python库时出现错误

rodolphe-mbp:python-Levenshtein-0.11.2 Rodolphe$ sudo python setup.py install 
running install 
running bdist_egg 
running egg_info 
writing requirements to python_Levenshtein.egg-info/requires.txt 
writing python_Levenshtein.egg-info/PKG-INFO 
writing namespace_packages to python_Levenshtein.egg-info/namespace_packages.txt 
writing top-level names to python_Levenshtein.egg-info/top_level.txt 
writing dependency_links to python_Levenshtein.egg-info/dependency_links.txt 
writing entry points to python_Levenshtein.egg-info/entry_points.txt 
reading manifest file 'python_Levenshtein.egg-info/SOURCES.txt' 
reading manifest template 'MANIFEST.in' 
warning: no files found matching '*' under directory 'docs' 
warning: no previously-included files matching '*pyc' found anywhere in distribution 
warning: no previously-included files matching '.project' found anywhere in distribution 
warning: no previously-included files matching '.pydevproject' found anywhere in distribution 
writing manifest file 'python_Levenshtein.egg-info/SOURCES.txt' 
installing library code to build/bdist.macosx-10.9-intel/egg 
running install_lib 
running build_ext 
building 'Levenshtein' extension 
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c Levenshtein.c -o build/temp.macosx-10.9-intel-2.7/Levenshtein.o 
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: command 'cc' failed with exit status 1 

如在别处建议的,我试图进入终端“ARCHFLAGS = -Wno误差=未使用的命令行参数的硬错误功能于未来须藤蟒的setup.py安装”,但是没有成功。

有没有解决这个问题似乎已经出现在Xcode 5.1?

回答

7

与安装(程序文件夹内,你拉下来)

sudo -E python setup.py install 

做的工作!

72

运行这两条线在你的shell,然后建立:

export CFLAGS=-Qunused-arguments 
export CPPFLAGS=-Qunused-arguments 

这些出口告诉编译器忽略未使用的参数,而不是抱怨他们。


的原因似乎是,Python是使用它内置的选项编译模块,但这些选择不再在小牛队的工作之一:

铛3.4苹果是航运默认在未知标志上出现错误,但CPython使用与最初编译相同的一组标志来构建模块。

(来源:https://stackoverflow.com/a/22315129/65295

很多人都遇到了此:

+0

非常感谢!我之前尝试过,没有成功。然而,直接安装-E标志完成了这项工作。 – Rodolphe

+7

如果你是'sudo'-ing,那么是的,你需要'sudo -E'来传播环境变量。对于只是建立(在你有写权限的目录中),它应该没有关系。 – Seth

+0

在virtualenv它似乎工作! – JhovaniC

27

对我的问题是我刚刚升级了XCode并需要安装命令行工具(请参阅this answer)。

运行后xcode-select --install我的python库安装正常。

+1

是的,这固定我的python安装问题。 – Rao

+1

为我工作;万分感谢! – Aravind

相关问题