import pystan._api failed:ImportError: DLL load failed: 找不到指定的模块

Van*_*era 7 python importerror pystan

我已经安装了 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.
Run Code Online (Sandbox Code Playgroud)

我做了一些研究,并知道使用 conda 是可能的。但我正在寻找不使用 conda 的解决方案。

提前致谢。

Aka*_*iya 5

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. pip 安装 numpy cython

  5. pip 安装 pystan==2.17.1

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

  7. pip 安装 fbprophet==0.6

  • 你使用的是哪个版本的Python?在 Python 3.8.10 上,我可以成功编译 pystan 2.17.1,但是当我尝试验证它时,导入模块失败并显示:“ImportError: DLL load failed while importing _api” (2认同)