如何解决没有名为' hmmlearn' Jupyter笔记本中的错误

时间:2018-01-20 11:47:49

标签: python numpy jupyter-notebook hmmlearn

我是hmmlearn的新手,我正在尝试使用Jupyter Notebook来完成这个Gaussian HMM of stock data example。但是,当我运行以下代码时,我收到错误。

from __future__ import print_function

import datetime

import numpy as np
from matplotlib import cm, pyplot as plt
from matplotlib.dates import YearLocator, MonthLocator
try:
    from matplotlib.finance import quotes_historical_yahoo_ochl
except ImportError:
    # For Matplotlib prior to 1.5.
    from matplotlib.finance import (
        quotes_historical_yahoo as quotes_historical_yahoo_ochl
    )

from hmmlearn.hmm import GaussianHMM


print(__doc__)

错误如下:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-02bbde14d4d4> in <module>()
     14     )
     15 
---> 16 from hmmlearn.hmm import GaussianHMM
     17 
     18 

ModuleNotFoundError: No module named 'hmmlearn'

我花了一段时间搜索互联网并试图找出原因。我确保已经下载了依赖项(scikit-learn,numpy和scipy),并且我已经通过Windows cmd运行pip install -U --user hmmlearn并且如上所述{{3} }。但是,我一直得到同样的错误。我不确定它是否与我计算机上不同软件包的位置有关(我使用的是Windows)。

有没有人对我可以尝试解决这个问题有什么建议? (我的主要目的是能够设置hmmlearn,以便我可以开始使用它来探索HMM。)

1 个答案:

答案 0 :(得分:2)

page 提供了许多科学开源扩展包的32位和64位 Windows 二进制文件,用于Python编程语言的官方CPython发行版。

根据系统要求选择适当的文件。 (对我来说,它是python 3.7和Windows 64位)

下载此文件后,在与.whl文件相同的文件夹中打开命令提示符,然后键入:

pip install hmmlearn-0.2.1-cp37-cp37m-win_amd64.whl

然后您可以像这样在 Jupyter Notebook 中使用 hmmlearn

import hmmlearn
# Or 
from hmmlearn import hmm