簡體   English   中英

安裝python庫時,“'cc'以退出狀態1失敗”錯誤

[英]“'cc' failed with exit status 1” error when install python library

像許多其他人一樣,我在安裝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

正如其他地方所建議的那樣,我嘗試進入終端“ARCHFLAGS = -Wno-error = unused-command-line-argument-hard-error-in-future sudo python setup.py install”,但沒有成功。

有沒有解決這個問題似乎與xcode 5.1一起出現的問題?

在構建之前在shell中運行以下兩行:

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

這些導出告訴編譯器忽略未使用的參數而不是抱怨它們。


原因似乎是Python正在使用它構建的選項編譯模塊,除了其中一個選項不再適用於小牛隊:

clang 3.4 Apple默認為未知標志出錯,但CPython使用最初編譯的同一組標志構建模塊。

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

很多人都遇到了這個問題:

對我來說問題是我剛剛升級了XCode並需要安裝命令行工具(請參閱此答案 )。

運行xcode-select --installxcode-select --install我的python庫安裝得很好。

安裝(在你拉下的程序文件夾內)

sudo -E python setup.py install

做了這個工作!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM