导入pystan.\u api失败:导入错误:DLL加载失败:找不到指定的模块

2024-10-02 14:18:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经安装了Python3.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的解决方案

提前谢谢


Tags: inpyimportapivenvlibpackagesline
2条回答

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

    < P>安装C++编译器、明文-W64(http://mingw-w64.org/doku.php/download)-gt;我选择了这个https://sourceforge.net/projects/mingw-w64/files/

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

  2. 在Python安装目录(在venv中)的\Lib\distutils文件夹中创建一个distutils.cfg文件,其中包含以下内容:

    [建造] 编译器=mingw32

    [构建扩展] 编译器=mingw32

  3. pip安装numpy cython

  4. pip安装pystan==2.17.1

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

  6. pip安装=0.6

跟随https://github.com/facebook/prophet/issues/1939 即使在安装了Mingw之后,我也遇到了类似的问题

conda install libpython m2w64-toolchain -c msys2 Solved all the errors and i am able to install fbprophet finally Thanks

相关问题 更多 >