导入pystan._api失败:ImportError: DLL加载失败:找不到指定的模块。

10

我已安装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的解决方案。

提前感谢。


提前感谢。

3个回答

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文件:

    [build] compiler=mingw32

    [build_ext] compiler=mingw32

  4. pip install 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


2
你使用的是哪个版本的Python?在Python 3.8.10上,我可以成功编译pystan 2.17.1,但当我尝试验证它时,导入模块失败并显示以下错误信息:ImportError: DLL load failed while importing _api - pruefsumme
很抱歉,已经过了一段时间,我无法确定在发布这个答案时使用的Python版本。最有可能是3.7.7。 - Akalanka Weerasooriya

3

0

我在使用Python3.6(anaconda)时遇到了类似的问题。

我以管理员权限重新安装了适用于所有用户的anaconda,然后运行了"conda install -c conda-forge pystan",之后更新了所有其他模块。

现在它可以正常工作,没有任何错误。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接