无法在pycharm中安装fbprophet

时间:2019-08-26 13:08:47

标签: python pycharm dllimport

嗨,我是python新手,正在尝试在pycharm中安装fbprophet,但遇到以下错误。我已经成功安装了pystan。

Building wheels for collected packages: fbprophet
  Building wheel for fbprophet (setup.py): started
  Building wheel for fbprophet (setup.py): finished with status 'error'
  Running setup.py clean for fbprophet
Failed to build fbprophet
Installing collected packages: fbprophet
  Running setup.py install for fbprophet: started
    Running setup.py install for fbprophet: finished with status 'error'

  ERROR: Command errored out with exit status 1:
   command: 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ankita.gupta\\AppData\\Local\\Temp\\pycharm-packaging\\fbprophet\\setup.py'"'"'; __file__='"'"'C:\\Users\\ankita.gupta\\AppData\\Local\\Temp\\pycharm-packaging\\fbprophet\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\ANKITA~1.GUP\AppData\Local\Temp\pip-wheel-9u7mn7vi' --python-tag cp37
       cwd: C:\Users\ankita.gupta\AppData\Local\Temp\pycharm-packaging\fbprophet\
  Complete output (40 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib
  creating build\lib\fbprophet
  creating build\lib\fbprophet\stan_model
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\ankita.gupta\AppData\Local\Temp\pycharm-packaging\fbprophet\setup.py", line 120, in <module>
      """
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\setuptools\__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\ankita.gupta\AppData\Local\Temp\pycharm-packaging\fbprophet\setup.py", line 44, in run
      build_stan_model(target_dir)
    File "C:\Users\ankita.gupta\AppData\Local\Temp\pycharm-packaging\fbprophet\setup.py", line 27, in build_stan_model
      from pystan import StanModel
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\pystan\__init__.py", line 9, in <module>
      from pystan.api import stanc, stan
    File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\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. 

关于如何解决它的任何想法,有人吗? 预先非常感谢。

2 个答案:

答案 0 :(得分:2)

首先你得安装c++编译器,你可以安装c++编译器

pip install libpython m2w64-toolchain -c msys2

安装c++编译器后,您必须安装pystan,要安装pystan,您可以使用以下命令

pip install pystan

最后,现在我们准备安装 facebook 先知

pip install fbprophet

答案 1 :(得分:0)

我遇到了同样的问题,在 Windows10 Pycharm 虚拟环境中安装 fbprophet 时...

首先卸载我已经安装的任何 pystan、fbprophet 解决了这个问题:

pip uninstall pystan

pip uninstall fbprophet

然后使用 python.exe 重新安装这些库:

#PyStan:

python.exe -m pip install pystan==2.17.1.0

#fbProphet0.6:

python.exe -m pip install fbprophet==0.6 

#Upgrade fbProphet:

python.exe -m pip install --upgrade fbprophet

如果你按照这个步骤,prophet应该就安装成功了!

通过从 python 终端导入库来测试安装:

Python 3.7.3 

>>> import fbprophet
>>>

来源:Installing fbprophet Python on Windows 10