Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python中安装scikit learn的问题_Python_Pip_Scikit Learn - Fatal编程技术网

在Python中安装scikit learn的问题

在Python中安装scikit learn的问题,python,pip,scikit-learn,Python,Pip,Scikit Learn,我正在尝试安装python软件包scikit-…学习。我经常出错 我试过了 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

我正在尝试安装python软件包scikit-…学习。我经常出错

我试过了

 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_安装中,我还收到了以下错误消息

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

今天我也遇到了同样的问题,在尝试了很多事情之后,我的工作就是在安装pip之前设置一些环境变量,这为我解决了问题:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
然后使用sudo安装:

sudo -E pip install -U scikit-learn
这似乎是xcode update的一个问题(对我来说是5.1.1),它不接受“-mno fused madd”作为参数,在它抛出警告之前,知道是错误,前两个命令忽略未使用的参数,它们与抛出错误的参数相同


希望有帮助,欢迎您提供任何意见/更正。

这似乎是您的LLVM安装存在的问题。你确定你有最新版本的XCode CLI工具吗?scikit learn从NumPy获取了它的编译器参数,看起来你的NumPy是用GCC编译的,所以你需要用它来编译。对我来说也很有用,运行Mavericks