导入 sklearn 时出现 ImportError
ImportError while importing sklearn
我正在使用 python 3.7
最近我在导入 sklearn 模块时开始遇到这个错误。
我在 Jupyter Notebook,Python IDLE,Pycharm 虚拟环境
中得到同样的错误
>>> import sklearn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\aditya\AppData\Roaming\Python\Python37\site-packages\sklearn\__init__.py", line 75, in <module>
from .utils._show_versions import show_versions
File "C:\Users\aditya\AppData\Roaming\Python\Python37\site-packages\sklearn\utils\_show_versions.py", line 12, in <module>
from ._openmp_helpers import _openmp_parallelism_enabled
ImportError: DLL load failed: The specified module could not be found.
我也试过重新安装。
之后我复制了另一个没有问题的项目的venv的sklearn内容。这件事工作了几次。但是现在又不行了
注意:pandas、numpy、scipy 等已安装并且运行良好。几天前 Sklearn 也运行良好
这是 scikit-learn 0.22.0 中的打包问题,将在 0.22.1(下周发布)中解决。问题跟踪于:github.com/scikit-learn/scikit-learn/issues/15899。有 2 种可能的解决方法:
- 默认从 conda-forge 安装 scikit-learn(conda 包括缺少的 dll):
conda install conda-forge::scikit-learn
- 安装 VC++,它将包含 openmp 库 (https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
我正在使用 python 3.7 最近我在导入 sklearn 模块时开始遇到这个错误。 我在 Jupyter Notebook,Python IDLE,Pycharm 虚拟环境
中得到同样的错误>>> import sklearn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\aditya\AppData\Roaming\Python\Python37\site-packages\sklearn\__init__.py", line 75, in <module>
from .utils._show_versions import show_versions
File "C:\Users\aditya\AppData\Roaming\Python\Python37\site-packages\sklearn\utils\_show_versions.py", line 12, in <module>
from ._openmp_helpers import _openmp_parallelism_enabled
ImportError: DLL load failed: The specified module could not be found.
我也试过重新安装。 之后我复制了另一个没有问题的项目的venv的sklearn内容。这件事工作了几次。但是现在又不行了
注意:pandas、numpy、scipy 等已安装并且运行良好。几天前 Sklearn 也运行良好
这是 scikit-learn 0.22.0 中的打包问题,将在 0.22.1(下周发布)中解决。问题跟踪于:github.com/scikit-learn/scikit-learn/issues/15899。有 2 种可能的解决方法:
- 默认从 conda-forge 安装 scikit-learn(conda 包括缺少的 dll):
conda install conda-forge::scikit-learn
- 安装 VC++,它将包含 openmp 库 (https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)