我试图将Scikit-learn和Pandas放入Sage 7.2(在El Capitan上)。我在Sage 6.6中成功完成了此操作。但是,当我输入/Applications/SageMath-7.2.app/Contents/Resources/sage/sage --pip install scikit-learn
(pandas
的结果相同)时,我会收到以下错误消息。
creating build/temp.macosx-10.9-x86_64-2.7
creating build/temp.macosx-10.9-x86_64-2.7/sklearn
creating build/temp.macosx-10.9-x86_64-2.7/sklearn/svm
creating build/temp.macosx-10.9-x86_64-2.7/sklearn/svm/src
creating build/temp.macosx-10.9-x86_64-2.7/sklearn/svm/src/libsvm
compile options: '-I/Applications/SageMath-7.2.app/Contents/Resources/sage/local/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.9-x86_64.egg/numpy/core/include -c'
g++: sklearn/svm/src/libsvm/libsvm_template.cpp
In file included from sklearn/svm/src/libsvm/svm.cpp:53:0,
from sklearn/svm/src/libsvm/libsvm_template.cpp:6:
/Applications/SageMath-7.2.app/Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.4.0/4.9.3/include-fixed/math.h:45:23: fatal error: sys/cdefs.h: No such file or directory
#include <sys/cdefs.h>
^
compilation terminated.
In file included from sklearn/svm/src/libsvm/svm.cpp:53:0,
from sklearn/svm/src/libsvm/libsvm_template.cpp:6:
/Applications/SageMath-7.2.app/Contents/Resources/sage/local/lib/gcc/x86_64-apple-darwin15.4.0/4.9.3/include-fixed/math.h:45:23: fatal error: sys/cdefs.h: No such file or directory
#include <sys/cdefs.h>
^
compilation terminated.
error: Command "g++ -fno-strict-aliasing -I/Applications/SageMath-7.2.app/Contents/Resources/sage/local/var/tmp/sage/build/python2-2.7.10.p1/include -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -I/Applications/SageMath-7.2.app/Contents/Resources/sage/local/lib/python2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.9-x86_64.egg/numpy/core/include -c sklearn/svm/src/libsvm/libsvm_template.cpp -o build/temp.macosx-10.9-x86_64-2.7/sklearn/svm/src/libsvm/libsvm_template.o" failed with exit status 1
----------------------------------------
Command failed with error code 1
我一直找不到任何方法。我唯一能想到的问题是安装说明是指macosx-10.9
,但El Capitan是10.11。所以也许是问题?
您的问题是Note No such file or directory
。我建议您安装命令行工具,甚至XCode。您是否按以下顺序做事?
- 安装鼠尾草
- 在某个时候,升级您的Mac OS
- 升级您的圣人
- 尝试安装熊猫等。
如果是这样,这可能是问题所在。我刚刚升级了Mac,不得不重新安装命令行工具,然后才能识别它。幸运的是,如今这不是很难 - 打开终端并尝试使用gcc
或其他东西,并且它应该提示您,尽管您的里程可能会有所不同。
那么您的命令应该正常工作,对我有用。