简体   繁体   中英

OSError: [WinError 126] The specified module could not be found in Python

I am trying to import the following libraries. I get an error message while importing sklearn. I believe it is related to DLL path but i am not able to rectify it. I don't want to manually specify any path in the code. Please help

Code:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

from sklearn import preprocessing
%matplotlib inline

Error:

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

You can try uninstalling scipy and then re-installing this particular verison. As it is stated in this particular github issue thread that there is a problem with the new release of scipy.

pip uninstall scipy
pip install scipy==1.4.1

https://github.com/ultralytics/yolov5/issues/241

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM