"' CC'退出状态1"安装python库时出错

时间:2014-03-27 19:33:10

标签: python clang osx-mavericks xcode5.1

像许多其他人一样,我在安装python库时遇到问题(以tar作为tar下载,然后解压缩)。

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-error = unused-command-line-argument-hard-error-in-future sudo python setup.py install”,但没有成功。

是否有解决此问题的方法似乎与xcode 5.1一起出现?

3 个答案:

答案 0 :(得分:76)

在构建之前在shell中运行以下两行:

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

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


原因似乎是Python正在使用它构建的选项来编译模块,除了其中一个选项不再适用于小牛:

  

clang 3.4 Apple默认将错误发送到未知标志,但CPython使用最初编译的同一组标志构建模块。

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

很多人都遇到了这个问题:

答案 1 :(得分:31)

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

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

答案 2 :(得分:8)

使用(在您下拉的程序文件夹内)安装

sudo -E python setup.py install

完成了这份工作!