当我尝试按照Windows上的说明从源代码构建statsmodel时:
http://www.statsmodels.org/dev/install.html
使用:
python setup.py install
我收到以下错误:
fatal error C1047: The object or library file 'C:\\Apps\\Anaconda3\\lib\\site-packages\\numpy\\core\\lib\npymath.lib' was created with an older
compiler than other objects; rebuild old objects and libraries
LINK : fatal error LNK1257: code generation failed
任何想法如何解决这个问题?我使用Anaconda3和numpy版本1.13.1以及Microsoft Visual Studio 2017. python setup.py install
的完整输出如下:
Cythonizing sources
statsmodels\nonparametric\linbin.pyx has not changed
statsmodels\nonparametric\_smoothers_lowess.pyx has not changed
statsmodels\tsa\kalmanf\kalman_loglike.pyx has not changed
statsmodels\tsa\regime_switching\_hamilton_filter.pyx.in has not changed
statsmodels\tsa\regime_switching\_kim_smoother.pyx.in has not changed
statsmodels\tsa\statespace\_kalman_filter.pyx.in has not changed
statsmodels\tsa\statespace\_kalman_smoother.pyx.in has not changed
statsmodels\tsa\statespace\_representation.pyx.in has not changed
statsmodels\tsa\statespace\_simulation_smoother.pyx.in has not changed
statsmodels\tsa\statespace\_statespace.pyx.in has not changed
statsmodels\tsa\statespace\_tools.pyx.in has not changed
statsmodels\tsa\statespace\_filters\_conventional.pyx.in has not changed
statsmodels\tsa\statespace\_filters\_inversions.pyx.in has not changed
statsmodels\tsa\statespace\_filters\_univariate.pyx.in has not changed
statsmodels\tsa\statespace\_smoothers\_alternative.pyx.in has not changed
statsmodels\tsa\statespace\_smoothers\_classical.pyx.in has not changed
statsmodels\tsa\statespace\_smoothers\_conventional.pyx.in has not changed
statsmodels\tsa\statespace\_smoothers\_univariate.pyx.in has not changed
running install
running bdist_egg
running egg_info
writing requirements to statsmodels.egg-info\requires.txt
writing statsmodels.egg-info\PKG-INFO
writing top-level names to statsmodels.egg-info\top_level.txt
writing dependency_links to statsmodels.egg-info\dependency_links.txt
package init file 'statsmodels\tsa\vector_ar\data\__init__.py' not found (or not a regular file)
reading manifest file 'statsmodels.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.pxi' anywhere in distribution
warning: no previously-included files matching '*' found under directory 'dist'
warning: no previously-included files found matching 'docs\source\generated\*'
warning: no previously-included files matching '*' found under directory 'docs\build'
warning: no previously-included files matching '*' found under directory 'docs\build\htmlhelp'
warning: no files found matching 'statsmodels\statsmodelsdoc.chm'
no previously-included directories found matching '*\__pycache__'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.swp' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.bak' found anywhere in distribution
writing manifest file 'statsmodels.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
copying statsmodels\version.py -> build\lib.win-amd64-3.5\statsmodels
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
building 'statsmodels.tsa.statespace._statespace' extension
C:\Apps\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Istatsmode
ls/src -IC:\\Apps\\Anaconda3\\lib\\site-packages\\numpy\\core\\include -IC:\Apps\Anaconda3\lib\site-packages\numpy\core\include -IC:\Apps\Anaco
nda3\include -IC:\Apps\Anaconda3\include -I"C:\Apps\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\Include" -I"C:\Apps\Micros
oft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\ATLMFC\Include" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\share
d" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" -I"
C:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" /Tcstatsmodels/tsa/statespace/_statespace.c /Fobuild\temp.win-amd64-3.5\Relea
se\statsmodels/tsa/statespace/_statespace.obj
C:\Apps\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /nodefaultlib:l
ibucrt.lib ucrt.lib /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\\Apps\\Anaconda3\\lib\\site-packages\\numpy\\core\\lib /LIBPATH:C:\Ap
ps\Anaconda3\libs /LIBPATH:C:\Apps\Anaconda3\PCbuild\amd64 /LIBPATH:"C:\Apps\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\L
ib\x64" /LIBPATH:"C:\Apps\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\ATLMFC\Lib\x64" /LIBPATH:"C:\Program Files (x86)\Win
dows Kits\10\lib\10.0.15063.0\um\x64" /LIBPATH:C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319 /LIBPATH:"C:\Program Files (x86)\Windows Kits\10
\lib\10.0.15063.0\ucrt\x64" npymath.lib /EXPORT:PyInit__statespace build\temp.win-amd64-3.5\Release\statsmodels/tsa/statespace/_statespace.obj
/OUT:build\lib.win-amd64-3.5\statsmodels\tsa\statespace\_statespace.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\statsmodels/tsa
/statespace\_statespace.cp35-win_amd64.lib
fatal error C1047: The object or library file 'C:\\Apps\\Anaconda3\\lib\\site-packages\\numpy\\core\\lib\npymath.lib' was created with an older
compiler than other objects; rebuild old objects and libraries
LINK : fatal error LNK1257: code generation failed
error: Command "C:\Apps\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\link.exe /nologo /INCREMENTAL:NO /LTCG
/nodefaultlib:libucrt.lib ucrt.lib /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\\Apps\\Anaconda3\\lib\\site-packages\\numpy\\core\\li
b /LIBPATH:C:\Apps\Anaconda3\libs /LIBPATH:C:\Apps\Anaconda3\PCbuild\amd64 /LIBPATH:"C:\Apps\Microsoft Visual Studio\2017\Community\VC\Tools\MS
VC\14.11.25503\Lib\x64" /LIBPATH:"C:\Apps\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\ATLMFC\Lib\x64" /LIBPATH:"C:\Program
Files (x86)\Windows Kits\10\lib\10.0.15063.0\um\x64" /LIBPATH:C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319 /LIBPATH:"C:\Program Files (x86)
\Windows Kits\10\lib\10.0.15063.0\ucrt\x64" npymath.lib /EXPORT:PyInit__statespace build\temp.win-amd64-3.5\Release\statsmodels/tsa/statespace/
_statespace.obj /OUT:build\lib.win-amd64-3.5\statsmodels\tsa\statespace\_statespace.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release
\statsmodels/tsa/statespace\_statespace.cp35-win_amd64.lib" failed with exit status 1257
答案 0 :(得分:2)
答案 1 :(得分:1)
这是Python 3.6.3 https://bugs.python.org/issue31340
上的distutils
问题
"%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64
set DISTUTILS_USE_SDK=1
python setup.py install