安装statsmodels模块时报错:
building 'statsmodels.tsa.regime_switching._hamilton_filter' extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
----------------------------------------
Failed building wheel for statsmodels
Failed building wheel for statsmodels
以上信息是说,statsmodels模块依赖microsoft vc++9.0,需要先进行安装。
因此解决问题之道在于正确的模块安装顺序。
一、首先安装numpy模块(如果已安装可以跳过)
pip install numpy
安装numpy过程中如果遇到问题,可以从 http://www.lfd.uci.edu/~gohlke/pythonlibs/获取你需要的windows预编译版本,并进行pip安装。(当window版本不同时,python的版本也不同):
numpy 32-bit: numpy-1.11.1+mkl-cp27-cp27m-win32.whl
numpy 64-bit: numpy-1.11.1+mkl-cp27-cp27m-win_amd64.whl
二、安装VC++ 9.0
从微软官网下载 VC++ 9.0,地址是: http://aka.ms/vcpython27。然后运行安装文件VCForPython27.msi完成安装。
三、安装Scipy
依然根据python和windows的版本从网站 http://www.lfd.uci.edu/~gohlke/pythonlibs/获取windows预编译版本,并进行pip安装:
Scipy 32-bit: scipy-0.18.0-cp27-cp27m-win32.whl
Scipy 64-bit: scipy-0.18.0-cp27-cp27m-win_amd64.whl
如果安装过程中报错:
whl is not supported wheel on this platform
则需要用以下命令升级pip:
python -m pip install --upgrade pip
升级完毕后用以下命令重新安装scipy
pip install scipy
四、安装statsmodels
pip install statsmodels
著作权归作者所有。商业转载请联系本站作者获得授权,非商业转载请注明出处 ZZKOOK。
评论
谢谢分享
认识你这么久了,觉得这才是你
这么好的经验,给跪了
有时候会悲观,想到ZZKOOK的分享,心又暖了。
难得!