我试图让 pystan 在 Windows 10 上工作,以便将 fbprophet 包用于时间序列。我已经安装了 MinGW,将它的目录添加到我的 PATH 环境变量中,并尝试了这段代码来验证一切是否正常:
gcc -dumpversion
ld -v
dllwrap -version
产生这些结果:
C:\WINDOWS\system32>gcc -dumpversion
6.3.0
C:\WINDOWS\system32>ld -v
GNU ld (GNU Binutils) 2.28
C:\WINDOWS\system32>dllwrap -version
GNU dllwrap (GNU Binutils) 2.28
Copyright (C) 2017 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
到目前为止一切正常。
一旦在python中出现问题,我尝试执行以下代码:
import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)
y = model.sampling(n_jobs > 1).extract()['y']
y.mean() # with luck the result will be near 0
我得到这个输出:
import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)
y = model.sampling(n_jobs > 1).extract()['y']
y.mean() # with luck the result will be near 0
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_5944b02c79788fa0db5b3a93728ca2bf NOW.
Traceback (most recent call last):
File "<ipython-input-3-941feb69c4c4>", line 3, in <module>
model = pystan.StanModel(model_code=model_code)
File "Z:\Anaconda3\lib\site-packages\pystan\model.py", line 313, in __init__
build_extension.run()
File "Z:\Anaconda3\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "Z:\Anaconda3\lib\distutils\command\build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "Z:\Anaconda3\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "Z:\Anaconda3\lib\distutils\command\build_ext.py", line 533, in build_extension
depends=ext.depends)
File "Z:\Anaconda3\lib\distutils\ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "Z:\Anaconda3\lib\distutils\cygwinccompiler.py", line 175, in _compile
raise CompileError(msg)
CompileError: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
在发布此问题之前,我已经在网站以及其他网站上进行了搜索,但似乎没有什么对我有用。我会很感激任何帮助。
提前致谢