python - pystan : distutils. 错误。编译错误:命令 'gcc' 失败,退出状态为 1

标签 python ubuntu anaconda stan

我正在使用 Ubuntu 14.04.3 和最新版本的 anaconda。

当 pystan 尝试编译模型时,我收到以下错误:

distutils.errors.CompileError: command 'gcc' failed with exit status 1

当我尝试在工作时在我的 RHEL 服务器上运行模型时,一切正常。

在安装pystan之前,我跑了
apt-get install build-essential

我尝试使用 anaconda 安装 stan 并从源代码构建,但仍然出现错误。

我不知道接下来要尝试什么。

编辑:完整的错误输出如下
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_900950b5a4d15a106db93874d106a01d NOW.
Traceback (most recent call last):
  File "schools.py", line 63, in <module>
    main()
  File "schools.py", line 59, in main
    output = fit()
  File "schools.py", line 54, in fit
    res = pystan.stan(model_code=pasted_code(), data=model_data, iter=1000, chains=4)
  File "/home/hahdawg/anaconda/lib/python2.7/site-packages/pystan/api.py", line 373, in stan
    save_dso=save_dso, verbose=verbose)
  File "/home/hahdawg/anaconda/lib/python2.7/site-packages/pystan/model.py", line 319, in __init__
    build_extension.run()
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/command/build_ext.py", line 337, in run
    self.build_extensions()
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/command/build_ext.py", line 446, in build_extensions
    self.build_extension(ext)
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/command/build_ext.py", line 496, in build_extension
    depends=ext.depends)
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/unixccompiler.py", line 122, in _compile
    raise CompileError, msg
distutils.errors.CompileError: command 'gcc' failed with exit status 1

最佳答案

如果有人有同样的问题,以下步骤解决了问题

  • 卸载 Anaconda
  • 安装 Anaconda
  • 使用 pip
  • 安装 pystan

    不知道为什么会这样。

    关于python - pystan : distutils. 错误。编译错误:命令 'gcc' 失败,退出状态为 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32783755/

    相关文章:

    python - 什么相当于 nodejs 中的 Pythons "pickle"

    python - 为什么需要 processEvents() 才能让 QThread 工作?

    perl - perl 中的 mysqldump - 返回值始终为 0

    bash - 如何使用 grep 提取不重复的字符串模式

    python-3.x - 如何在 RaspBerry Pi 3 Model B 上安装 Anaconda

    python - 锁定多处理包不起作用

    python - 在 for 循环中使用 if 语句时 python 中的缩进错误

    php - 队列通知 laravel 5.3 问题

    ubuntu - 在 anaconda 中安装包 gcc-7 时发生错误

    python - Mac Big Sur 上安装 Anaconda Python 无法打开