首页 > 解决方案 > import pystan._api failed:ImportError: DLL load failed: 找不到指定的模块

问题描述

我已经安装了 python 3.7 并想使用 fbprophet ( https://facebook.github.io/prophet/docs/installation.html#python )进行一些预测

但是在使用命令安装软件包时出现此错误(pip install fbprophet)

import pystan
  File "e:\repos\usf\venv\lib\site-packages\pystan\__init__.py", line 9, in <module>
    from pystan.api import stanc, stan
  File "e:\repos\usf\venv\lib\site-packages\pystan\api.py", line 13, in <module>
    import pystan._api  # stanc wrapper
ImportError: DLL load failed: The specified module could not be found.

我做了一些研究,并知道这可以通过 conda 实现。但我正在寻找不使用 conda 的解决方案。

提前致谢。

标签: pythonimporterrorpystan

解决方案


它在Pystan 文档中说,在 Windows 上配置 C++ 编译器可能具有挑战性。以下方法适用于我安装 Pystan 2.17.1 和 FBProphet 0.6:

  1. 安装 C++ 编译器,mingw-w64 ( http://mingw-w64.org/doku.php/download ) -> 我选择了这个https://sourceforge.net/projects/mingw-w64/files/

  2. 将 C:<MinGW_w64 安装目录>\bin 添加到 PATH 环境变量中

  3. 在 Python 安装目录(在 venv 中)的文件夹 \Lib\distutils 中创建具有以下内容的 distutils.cfg 文件:

    [构建] 编译器=mingw32

    [build_ext] 编译器=mingw32

  4. 点安装 numpy cython

  5. pip install pystan==2.17.1

  6. 验证 Pystan 安装 ( https://pystan.readthedocs.io/en/latest/windows.html )

  7. pip install fbprophet==0.6


推荐阅读