2014-04-09 24 views
8

Tôi đã cố gắng cài đặt gói python scikit-learn. Tôi tiếp tục gặp lỗi.Các vấn đề về cài đặt scikit-learn trong Python

tôi đã cố gắng

pip install scikit­-learn 

Các lỗi trông giống như sau. Vấn đề cài đặt của tôi là gì?

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 

Tôi cũng đã thử một số cách khác nhau để cài đặt gói. Từ easy_install, tôi cũng nhận được thông báo lỗi sau.

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

Điều này giống như một vấn đề với cài đặt LLVM của bạn. Bạn có chắc là bạn có phiên bản mới nhất của các công cụ XCode CLI không? – inspectorG4dget

+0

scikit-learn mất trình biên dịch của nó args từ NumPy và có vẻ như NumPy của bạn đã được biên dịch với GCC, vì vậy bạn cần phải biên dịch với điều đó. –

Trả lời

6

Tôi có những rắc rối tương tự ngày hôm nay, sau khi thử nhiều thứ một trong đó làm việc tôi đã đặt một số biến môi trường trước khi cài đặt với pip giải quyết vấn đề đối với tôi:

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

Và sau đó cài đặt với sudo :

sudo -E pip install -U scikit-learn 

nó dường như là một vấn đề với bản cập nhật xcode (5.1.1 cho tôi), nó không chấp nhận '-mno-hợp nhất-Madd' như một cuộc tranh cãi, trước khi nó ném nó một cảnh báo, biết là một lỗi, hai lệnh đầu tiên bỏ qua các đối số không sử dụng đối số là giống như ném lỗi.

Hy vọng điều đó sẽ giúp ích, mọi nhận xét/chỉnh sửa đều được hoan nghênh.

+2

Làm việc cho tôi, chạy Mavericks – themaestro

Các vấn đề liên quan