PYTHON DLL load failed

2019-02-12 08:53发布

问题:

I usually code in Matlab but I found a nice piece of PYTHON code that I would like to use. However having downloaded the package it is proving difficult to run. I'm getting the following error:

Traceback (most recent call last):
  File "C:\launch.py", line 29, in <module>
    from src.smcsquare import SMCsquare
  File "C:\src\smcsquare.py", line 32, in <module>
    from scipy.stats import norm
  File "C:\Python34\lib\site-packages\scipy\stats\__init__.py", line 338, in <module>
    from .stats import *
  File "C:\Python34\lib\site-packages\scipy\stats\stats.py", line 184, in <module>
    import scipy.special as special
  File "C:\Python34\lib\site-packages\scipy\special\__init__.py", line 586, in <module>
    from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.

The _ufuncs.pyd is there in the C:\Python34\lib\site-packages\scipy\special\ directory. I tried adding this to my PYTHONPATH but it made no difference. I have also tried so dll fixers but these have not helped. Has anyone encountered this and did you find a solution?

回答1:

As other have said, make sure your .whl file matches the version and 32/64bit of the python distribution you're using.

Next, the problem I was having was I forgot to download and install the extra "numpy+mkl" package per the instruction: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

So for me it was numpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl, which I downloaded and then:

python -m pip install numpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl

I had already installed the regular numpy package via pip, but I just installed this one over it and everything started working and has been fine so far.



标签: python dll scipy