导入sklearn时出错
作者:互联网
Python版本:3.5.2
我开始学习机器学习和事物…所以我安装了sklearn和其他一些以pip形式出现的软件包.除了sklearn以外,所有其他组件都能够成功安装,因此我下载了车轮并从here开始安装.安装成功,但是当我尝试导入以检查正确安装的顺序时,出现了很多错误:
Traceback (most recent call last):
File “C:\MyFiles\Programs\Python\PlayGround.py”, line 1, in
import sklearn
File “C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn__init__.py”, line 134, in
from .base import clone
File “C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\base.py”, line 12, in
from .utils.fixes import signature
File “C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils__init__.py”, line 11, in
from .validation import (as_float_array,
File “C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\validation.py”, line 18, in
from ..utils.fixes import signature
File “C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\sklearn\utils\fixes.py”, line 144, in
from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
File “C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\scipy\sparse\linalg__init__.py”, line 114, in
from .isolve import *
File “C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\scipy\sparse\linalg\isolve__init__.py”, line 6, in
from .iterative import *
File “C:\Users\Vaibhav Acharya\AppData\Local\Programs\Python\Python35\lib\site-packages\scipy\sparse\linalg\isolve\iterative.py”, line 7, in
from . import _iterativeImportError: DLL load failed: The specified module could not be found.
代码只是:
import sklearn
我已经检查了下载的车轮包装的正确版本.
我该如何纠正它以及为什么会发生?
解决方法:
以下步骤解决了我的问题:
>卸载numpy,sklearn和scipy.
>从here下载numpy mkl和scipy.
>首先安装numpy mkl,然后安装scipy.
>从pip安装sklearn.
标签:python,python-3-x,scikit-learn,pip,python-wheel 来源: https://codeday.me/bug/20191010/1885318.html