ImportError: DLL load failed: when importing stats

2020-04-11 10:37发布

问题:

My Python version is 3.5 on win32. I successfully installed Numpy+MKL, Scipy and Statsmodels from here http://www.lfd.uci.edu/~gohlke/pythonlibs/

However, when I run

    import statsmodels as sm

I get the following error:

Traceback (most recent call last):
File "D:\Python\Innovation\try\Try_Reg.py", line 6, in <module>
import statsmodels as sm
File "C:\Python35\lib\site-packages\statsmodels\__init__.py", line 8, in <module>
from .tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning, File "C:\Python35\lib\site-packages\statsmodels\tools\__init__.py", line 1, in <module>
from .tools import add_constant, categorical  File "C:\Python35\lib\site-packages\statsmodels\tools\tools.py", line 9, in <module>
from statsmodels.distributions import (ECDF, monotone_fn_inverter, File "C:\Python35\lib\site-packages\statsmodels\distributions\__init__.py",   line 1, in <module>
from .empirical_distribution import ECDF, monotone_fn_inverter, StepFunction   File "C:\Python35\lib\site-packages\statsmodels\distributions\empirical_distribution.py", line 5, in <module>
from scipy.interpolate import interp1d File "C:\Python35\lib\site-packages\scipy\interpolate\__init__.py", line 145, in <module>
from .interpolate import *  File "C:\Python35\lib\site-packages\scipy\interpolate\interpolate.py", line 16, in <module>
import scipy.special as spec  File "C:\Python35\lib\site-packages\scipy\special\__init__.py", line 601, in <module>
from ._ufuncs import *  File "scipy\special\_ufuncs.pyx", line 1, in init scipy.special._ufuncs (scipy\special\_ufuncs.c:26071)
ImportError: DLL load failed: The specified module could not be found.

How can I fix this?

回答1:

Try installing Visual C++ Redistributable from https://www.microsoft.com/en-us/download/details.aspx?id=48145