python DLL load failed (statsmodels)

2020-05-03 10:35发布

问题:

My Python version is 2.7.9 and OS is Windows 8.

Writing import statsmodels.api

   Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import statsmodels.api
  File "C:\Python27\lib\site-packages\statsmodels-0.6.1-py2.7-win-amd64.egg\statsmodels\__init__.py", line 8, in <module>
    from .tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning,
  File "C:\Python27\lib\site-packages\statsmodels-0.6.1-py2.7-win-amd64.egg\statsmodels\tools\__init__.py", line 1, in <module>
    from .tools import add_constant, categorical
  File "C:\Python27\lib\site-packages\statsmodels-0.6.1-py2.7-win-amd64.egg\statsmodels\tools\tools.py", line 8, in <module>
    from scipy.linalg import svdvals
  File "C:\Python27\lib\site-packages\scipy\linalg\__init__.py", line 161, in <module>
    from .misc import *
  File "C:\Python27\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
    from . import blas
  File "C:\Python27\lib\site-packages\scipy\linalg\blas.py", line 155, in <module>
    from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found

How can I solve this problem? I find fblas.py fblas.pyc _fblas.pyd but no _fblas.pyin C:\Python27\lib\site-packages\scipy\linalg Is this where the problem is?

回答1:

Apparently there can be issues with certain scipy modules and pyinstaller. Modules such as linalg and interpolate rely on fblas.py which may be missing in the PythonVersion\Lib\site-packages\scipy\linalg folder.

This is an issue with numpy. Installing numpy+mkl fixed this for me and copied the correct file to this directory.

Numpy+mkl can be found here Be sure to uninstall previous version of numpy.