我是hmmlearn的新手,并尝试使用Jupyter Notebook来完成这个股票数据高斯HMM示例。然而,当我运行以下代码时,出现了错误。
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
。但是,我一直收到相同的错误。我不确定这是否与我的计算机上不同软件包的位置有关(我正在使用Windows)。 有人有建议可以尝试解决这个问题吗? (我的主要目标只是能够设置hmmlearn,以便我可以开始使用它来探索HMMs。)
import hmmlearn
时,它似乎是正常运行的。没有返回任何内容,提示符也像往常一样显示出来。当我在Python 3的shell中运行import hmmlearn
时,我得到了与我在问题中发布的相同的错误。有什么建议吗? - Caleb Owusu-Yianoma