本文介绍了PYTHON DLL加载失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常在Matlab中编写代码,但是我发现了一个很好的PYTHON代码,我想使用。但是,已经下载了这个软件包,很难运行。我收到以下错误:

 追溯(最近的最后一次呼叫):
文件C:\ launch.py​​,第29行,位于< module>
从src.smcsquare导入SMCsquare
文件C:\src\smcsquare.py,第32行,< module>
来自scipy.stats import norm
文件C:\Python34\lib\site-packages\scipy\stats\__init __。py,第338行,< module>
.stats import *
文件C:\Python34\lib\site-packages\scipy\stats\stats.py,第184行在< module>
import scipy.special as special
文件C:\Python34\lib\site-packages\scipy\special\__init __。py,第586行,< module>
from ._ufuncs import *
ImportError:DLL加载失败:无法找到指定的模块。

_ufuncs.pyd C:\Python34\lib\site-packages\scipy\special\ 目录。我尝试将其添加到我的 PYTHONPATH 中,但没有任何区别。我也试过这样的dll修复程序,但这些没有帮助。
有没有人遇到过这个,你是否找到一个解决方案?

解决方案

正如其他人所说,确保你的文件匹配您正在使用的版本和32/64位的python分发。



接下来,我遇到的问题是我忘记下载并安装额外的numpy + mkl包装说明:



所以对我来说是numpy-1.11.0 + mkl-cp35-cp35m-win_amd64.whl,其中然后:

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

我已经通过pip安装了常规的numpy包,但是我刚刚安装了这个,并且一切都开始工作迄今为止一直很好。


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?

解决方案

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加载失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 09:54
查看更多