“安装python库时'cc'失败,退出状态1”错误
像其他许多人一样,我遇到安装python库的问题(作为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
正如其他地方所build议的,我尝试在terminal“ARCHFLAGS = -Wno-error = unused-command-line-argument-hard-error-in-sudo python setup.py install”中input,但没有成功。
有没有办法解决这个问题似乎已经出现在Xcode 5.1?
在构build之前,在shell中运行这两行代码:
export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments
这些导出告诉编译器忽略不用的参数,而不是抱怨它们。
原因似乎是,Python正在使用它所构build的选项编译模块,除了其中一个选项不再适用于特拉维斯:
铿锵3.4苹果出货默认是错误的未知标志,但CPython使用最初编译的同一组标志生成模块。
(从: https : //stackoverflow.com/a/22315129/65295 )
很多人遇到这个问题:
- Ansible安装-clang:错误:未知参数:'-mno-fused-madd'
- 无法在Mac Mavericks上安装python mysql库
- 铛错误:未知参数:'-mno-fused-madd'(python软件包安装失败)
对我来说,问题是我刚刚升级了XCode,需要安装命令行工具(请参阅此答案 )。
运行后xcode-select --install
我的python库安装正常。
安装(在你下拉的程序文件夹内)
sudo -E python setup.py install
做了这个工作!