python – 导入scikit-learn模块时出错
发布时间:2020-12-20 13:06:27 所属栏目:Python 来源:网络整理
导读:我试图从集群模块调用一个函数,如下所示: import sklearndb = sklearn.cluster.DBSCAN() 我收到以下错误: AttributeError: 'module' object has no attribute 'cluster' 在IPython中完成制表符,我似乎可以访问base,clone,externals,re,setup_module,sys和w
我试图从集群模块调用一个函数,如下所示:
import sklearn db = sklearn.cluster.DBSCAN() 我收到以下错误: AttributeError: 'module' object has no attribute 'cluster' 在IPython中完成制表符,我似乎可以访问base,clone,externals,re,setup_module,sys和warning模块.没有别的,尽管其他人(包括集群)在sklearn目录中. 遵循以下pbu的建议并使用 from sklearn import cluster 我明白了: Traceback (most recent call last): File "test.py",line 2,in <module> from sklearn import cluster File "C:Python34libsite-packagessklearncluster__init__.py",line 6,in <module> from .spectral import spectral_clustering,SpectralClustering File "C:Python34libsite-packagessklearnclusterspectral.py",line 13,in <module> from ..utils import check_random_state,as_float_array File "C:Python34libsite-packagessklearnutils__init__.py",line 16,in <module> from .class_weight import compute_class_weight,compute_sample_weight File "C:Python34libsite-packagessklearnutilsclass_weight.py",line 7,in <module> from ..utils.fixes import in1d File "C:Python34libsite-packagessklearnutilsfixes.py",line 318,in <module> from scipy.sparse.linalg import lsqr as sparse_lsqr File "C:Python34libsite-packagesscipysparselinalg__init__.py",line 109,in <module> from .isolve import * File "C:Python34libsite-packagesscipysparselinalgisolve__init__.py",in <module> from .iterative import * File "C:Python34libsite-packagesscipysparselinalgisolveiterative.py",in <module> from . import _iterative ImportError: DLL load failed: The specified module could not be found. 我在Windows上使用Python 3.4,scikit-learn 0.16.1. 解决方法
你可能不使用Numpy MKL,但只使用Numpy.
我有同样的问题,并重新安装Numpy与MKL pip install –upgrade –force-reinstall“numpy-1.10.2 mkl-cp35-none-win32.whl” 修复它(将文件更新到最新版本). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |