我正在尝试导入以下库。导入sklearn时收到错误消息。我相信它与DLL路径有关,但我无法纠正它。我不想在代码中手动指定任何路径。请帮忙
代码:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing
%matplotlib inline
错误:
OSError Traceback (most recent call last)
<ipython-input-3-c2a7628c052c> in <module>
3 import matplotlib.pyplot as plt
4
----> 5 from sklearn import preprocessing
6 get_ipython().run_line_magic('matplotlib', 'inline')
~\anaconda3\lib\site-packages\sklearn\__init__.py in <module>
62 else:
63 from . import __check_build
---> 64 from .base import clone
65 from .utils._show_versions import show_versions
66
~\anaconda3\lib\site-packages\sklearn\base.py in <module>
10
11 import numpy as np
---> 12 from scipy import sparse
13 from .externals import six
14 from .utils.fixes import signature
~\anaconda3\lib\site-packages\scipy\__init__.py in <module>
102
103 # Allow distributors to run custom init code
--> 104 from . import _distributor_init
105
106 __all__ += _num.__all__
~\anaconda3\lib\site-packages\scipy\_distributor_init.py in <module>
59 os.chdir(libs_path)
60 for filename in glob.glob(os.path.join(libs_path, '*dll')):
---> 61 WinDLL(os.path.abspath(filename))
62 finally:
63 os.chdir(owd)
~\anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
362
363 if handle is None:
--> 364 self._handle = _dlopen(self._name, mode)
365 else:
366 self._handle = handle
OSError: [WinError 126] The specified module could not be found
答案 0 :(得分:0)
您可以尝试卸载 scipy,然后重新安装此特定版本。正如此特定 github 问题线程中所述,新版本的 scipy 存在问题。
pip uninstall scipy
pip install scipy==1.4.1