我不能在python3上导入scikit -learn。我怎么能导入它?

时间:2017-10-10 09:55:00

标签: python scikit-learn install pycharm

我成功安装了numpy-1.13.1 + mkl-cp36-cp36m-win32 .whl和scipy-0.19.1-cp36-cp36m-win32.whl,然后我成功安装了scikit-learn,但是当我运行import sklearn , pycharm给了我错误。我该如何解决这个问题? 我在Windows 10(64位)上安装了python3.6(32位)。

import sklearn

运行结果:

C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\python.exe "F:/Python/NS videos/cedes/Exercise 07 test.py"
Traceback (most recent call last):
  File "F:/Python/NS videos/cedes/Exercise 07 test.py", line 21, in <module>
    import sklearn
  File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\__init__.py", line 134, in <module>
    from .base import clone
  File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\base.py", line 12, in <module>
    from .utils.fixes import signature
  File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
    from .validation import (as_float_array,
  File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
    from ..utils.fixes import signature
  File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\utils\fixes.py", line 144, in <module>
    from scipy.sparse.linalg import lsqr as sparse_lsqr  # noqa
  File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\sparse\linalg\__init__.py", line 117, in <module>
    from .matfuncs import *
  File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\sparse\linalg\matfuncs.py", line 19, in <module>
    import scipy.special
  File "C:\Users\Emertat\AppData\Local\Programs\Python\Python36-32\lib\site-packages\scipy\special\__init__.py", line 640, in <module>
    from ._ufuncs import *
ImportError: DLL load failed: The specified procedure could not be found.

Process finished with exit code 1

1 个答案:

答案 0 :(得分:0)

首先,使用以下命令从Windows操作系统中删除sklearn -

pip uninstall scikit-learn

然后,您需要从他们自己的官方安装程序中安装 numpyscipy

来自pypi的scikit-learn的车轮软件包(.whl文件)可以使用pip实用程序安装。打开控制台,然后键入以下内容以将scikit-learn安装或升级到最新的稳定版本:

pip install -U scikit-learn

如果没有与您的python版本匹配的二进制软件包,则可以尝试从christoph gohlke unofficial windows installerspython distribution安装scikit-learn及其依赖项。