我一直在尝试机器学习,并且通过 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/