2014-04-09 69 views
8

我試圖安裝Python包scikit-learn。我一直得到一個錯誤。在Python中安裝scikit-learn的問題

我試圖

pip install scikit­-learn 

錯誤看起來像下面。我的安裝有什麼問題?

compile options: '-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -c' 

c++: sklearn/svm/src/libsvm/libsvm_template.cpp 

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 

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 "c++ -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 -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/Extras/lib/python/numpy/core/include -c sklearn/svm/src/libsvm/libsvm_template.cpp -o build/temp.macosx-10.9-intel-2.7/sklearn/svm/src/libsvm/libsvm_template.o" failed with exit status 1 

---------------------------------------- 
Cleaning up... 
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/scikit-learn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-GYuqQN-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/scikit-learn 
Storing debug log for failure in /Users/johnkuk/Library/Logs/pip.log 

我也嘗試了幾種不同的方法來安裝軟件包。從easy_install,我也收到以下錯誤消息。

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 
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 "c++ -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 -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/Extras/lib/python/numpy/core/include -c /private/tmp/easy_install-oD3dwa/scikit-learn-0.14.1/sklearn/svm/src/libsvm/libsvm_template.cpp -o build/temp.macosx-10.9-intel-2.7/private/tmp/easy_install-oD3dwa/scikit-learn-0.14.1/sklearn/svm/src/libsvm/libsvm_template.o" failed with exit status 1 
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/distutils/misc_util.py:252: RuntimeWarning: Parent module 'numpy.distutils' not found while handling absolute import 
    from numpy.distutils import log 
+0

這看起來像是您的LLVM安裝問題。你確定你有最新版本的XCode CLI工具嗎? – inspectorG4dget

+0

scikit-learn從NumPy中獲取它的編譯器參數,看起來你的NumPy是用GCC編譯的,所以你需要用它編譯。 –

回答

6

今天我有同樣的麻煩,試圖在一個工作我與PIP安裝之前設置一些環境變量,解決了這個問題對我來說很多事情之後:

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

然後使用sudo安裝:

sudo -E pip install -U scikit-learn 

它似乎是在Xcode更新(5.1.1對我來說)一個問題,它不接受「-mno融合,MADD」作爲參數,才扔了警告,知道是一個錯誤, 前兩個命令會忽略未使用的參數,它們與引發錯誤的參數相同。

希望它有幫助,歡迎任何意見/更正。

+2

爲我工作,運行小牛隊 – themaestro