【问题标题】:Scikit-learn and pandas in Sage 7.2Sage 7.2 中的 Scikit-learn 和 pandas
【发布时间】:2016-06-20 13:40:10
【问题描述】:

我正在尝试将 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。所以也许这就是问题所在?

【问题讨论】:

    标签: pandas scikit-learn pip osx-elcapitan sage


    【解决方案1】:

    您的问题是注释No such file or directory。我建议你安装命令行工具,甚至是 Xcode。你是按以下顺序做事的吗?

    1. 安装 Sage
    2. 在某个时候,升级您的 Mac 操作系统
    3. 升级您的 Sage
    4. 尝试安装 pandas 等

    如果是这样,这可能就是问题所在。我刚刚升级了我的 Mac,必须重新安装命令行工具两次才能识别它。幸运的是,现在这并不难 - 打开终端并尝试使用 gcc 或其他东西,它应该提示您,尽管您的里程可能会有所不同。

    那么你的命令应该可以正常工作,它对我有用。

    【讨论】:

    • 就是这样。升级到 El Capitan 后,我没有重新安装 Xcode 命令行工具。完成了,现在 scikit 和 pandas 安装正确。谢谢。
    猜你喜欢
    • 2018-01-27
    • 2018-01-17
    • 2018-09-30
    • 2015-07-04
    • 2016-04-01
    • 2013-11-02
    • 2019-04-20
    • 2020-01-25
    • 1970-01-01
    相关资源
    最近更新 更多