简体   繁体   English

CompileError:安装pystan时,命令'C:\\\\ MinGW \\\\ bin \\\\ gcc.exe'失败,退出状态为1

[英]CompileError : command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1 while installing pystan

i'm trying to get pystan to work on Windows 10 in order to use the fbprophet package for time series. 我试图让pystan在Windows 10上工作,以便将fbprophet包用于时间序列。 I have already installed MinGW, added its directories to my PATH environment variable and tried this piece of code to verify everything is working fine: 我已经安装了MinGW,将其目录添加到PATH环境变量中,并尝试使用以下代码来验证一切是否正常:

gcc -dumpversion
ld -v
dllwrap -version

which yields these results: 产生以下结果:

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.

everything iw working fine to this point. 至此一切正常。

The problems comes when once in python, i try to execute the following code: 问题一旦出现在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

for which i'm getting this output: 对于我得到这个输出:

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

I have searched on the website prior to posting this question, as well as in other websites, but nothing seems to work for me. 在发布此问题之前,我已经在网站上以及其他网站中进行了搜索,但是似乎没有任何用处。 I'd appreciate any help. 我将不胜感激。

Thanks in advance 提前致谢

I had a similar problem with installing pystan under MinGW and I solved it by 我在MinGW下安装pystan时遇到了类似的问题,并通过以下方法解决了问题

So if you follow the guide, you won't need to manually install MinGW, it will be installed under Anaconda as one of the steps in the installation guide. 因此,如果您遵循该指南,则无需手动安装MinGW,它将作为安装指南中的步骤之一安装在Anaconda下。

And you should always run your python scripts from Anaconda Prompt. 而且,您应该始终从Anaconda Prompt运行python脚本。 I guess that's because Anaconda Prompt prepares the environment for compiling (dependencies, etc.) properly which running vanilla Cmd will not. 我猜这是因为Anaconda Prompt正确准备了运行香草Cmd不会编译的环境(依赖项等)。 I hope this solves your problem as well. 我希望这也能解决您的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:安装python手套时,命令“ gcc”失败,退出状态为1 - error: command 'gcc' failed with exit status 1 while installing python glove 错误:安装mysqlclient时命令&#39;gcc&#39;失败,退出状态为1 - error: command 'gcc' failed with exit status 1 while installing mysqlclient 错误:命令'gcc'在安装pygresql时失败,退出状态为1 - error : command 'gcc' failed with exit status 1 while installing pygresql docker 中的 Python 错误 - distutils.errors.CompileError:命令“gcc”失败,退出状态为 1 - Python error in docker - distutils.errors.CompileError: command 'gcc' failed with exit status 1 安装 PyCrypto 时 cl.exe 失败,退出状态为 2 - cl.exe failed with exit status 2 while installing PyCrypto Python 错误:命令 &#39;...\\Microsoft Visual Studio 10.0\\\\VC\\\\BIN\\\\cl.exe&#39; 失败,退出状态为 2 - Python error: command '…\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2 在Google Colab笔记本中安装tsne:错误:命令&#39;x86_64-linux-gnu-gcc&#39;失败,退出状态为1 - Installing tsne in Google Colab notebook: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 在Centos 7上安装lxml - 错误:命令&#39;gcc&#39;失败,退出状态为4 - Install lxml on Centos 7 - error: command 'gcc' failed with exit status 4 “Pip install”导致“错误:命令‘gcc’失败,退出状态为 1” - “Pip install” causing “error: command 'gcc' failed with exit status 1” 错误:命令&#39;x86_64-linux-gnu-gcc&#39;在执行pip3安装python-geohash时失败,退出状态为1 - error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 while doing pip3 install python-geohash
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM