python - Scikit-learn安装: "ImportError: No module named sklearn"

标签 python numpy machine-learning installation scikit-learn

我一直在尝试机器学习,并且通过 anaconda 安装了 scikit-learn,但是当我尝试从 sklearn 导入时,我的解释器给了我一个 ImportError。当我尝试时

python setup.py install

在我的 site-packages/sklearn 目录中,我收到此错误:

creating build/temp.macosx-10.5-x86_64-3.5
creating build/temp.macosx-10.5-x86_64-3.5/src
creating build/temp.macosx-10.5-x86_64-3.5/src/libsvm
compile options: '-I/Users/jj/anaconda3/lib/python3.5/site-packages/numpy/core/include -c'
g++: src/libsvm/libsvm_template.cpp
clang: error: no such file or directory: 'src/libsvm/libsvm_template.cpp'
clang: error: no input files
clang: error: no such file or directory: 'src/libsvm/libsvm_template.cpp'
clang: error: no input files

我能够下载 SciPy、NumPy 和 nltk,因此不确定是否存在依赖性问题。

我对 Python 包和 scikit-learn 不太熟悉。 有谁知道这个错误意味着什么/如何继续?

最佳答案

您需要安装 libsvm。在Linux中是这样的:

sudo apt-get install libsvm-dev libsvm3 python-libsvm

您可能有更多已卸载的库。如果它们是 python 包,您可以使用 pip 安装它们。请看一下这个guide .

关于python - Scikit-learn安装: "ImportError: No module named sklearn",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34487189/

相关文章:

python - 循环一列并删除字符 - Python Pandas

machine-learning - 机器学习 - 故意过度拟合数据集

machine-learning - 如何在 tensorflow 中的 Softmax 分类器中使用验证监视器

python - 如何在sklearn的交叉验证中获得多类roc auc?

Python Numpy 将旋转矩阵应用于数组中的每一行

python - 来自 Enthought 的 Enaml 示例不适用于 Python(x,y) Enthought Tool Suite 版本的 Enaml

python - 带单位的圆形 Sympy Mul

python - 将字节字符串读取为 xls 文件

python - 使用 numpy 加速多个矩阵乘积

python - 使用python在sqlite3中存储numpy数组时遇到问题