Python 如何解决没有名为'的模块的问题;hmmlearn';Jupyter笔记本中的错误
我是hmmlearn的新手,正在尝试使用Jupyter笔记本来解决这个问题。但是,当我运行下面的代码时,我得到一个错误Python 如何解决没有名为'的模块的问题;hmmlearn';Jupyter笔记本中的错误,python,numpy,jupyter-notebook,hmmlearn,Python,Numpy,Jupyter Notebook,Hmmlearn,我是hmmlearn的新手,正在尝试使用Jupyter笔记本来解决这个问题。但是,当我运行下面的代码时,我得到一个错误 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 matpl
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'
---------------------------------------------------------------------------
ModuleNotFoundError回溯(上次最近调用)
在()
14 )
15
--->16从hmmlearn.hmm导入GaussianHMM
17
18
ModuleNotFoundError:没有名为“hmmlearn”的模块
我花了一段时间在互联网上搜索,试图找出发生这种情况的原因。我已经确保下载了依赖项(scikit learn、numpy和scipy),并通过Windows cmd和前面提到的运行了pip install-U--user hmmlearn
。然而,我一直得到同样的错误。我不确定这是否和我电脑上不同软件包的位置有关(我使用的是Windows)
有人对我能解决这个问题有什么建议吗?(我的主要目标是能够使用hmmlearn进行设置,以便我可以开始使用它来探索HMMs。)这为Python编程语言的官方CPython发行版提供了许多科学开源扩展包的32位和64位Windows二进制文件
根据您的系统要求选择适当的文件。(对我来说,是python 3.7和windows 64位)
下载此文件后,在与.whl文件相同的文件夹中打开命令提示符,并键入:
pip install hmmlearn-0.2.1-cp37-cp37m-win_amd64.whl
然后您可以在Jupyter笔记本中使用hmmlearn,如下所示:
import hmmlearn
# Or
from hmmlearn import hmm
您的计算机中有多个python吗?。你能在shell上导入hmmlearn吗?我有python2和python3。我将尝试在shell上导入hmmlearn。检查两个shell(py2和Py3)中的导入当我在python 2 shell上运行
import hmmlearn
时,它似乎正在运行。没有返回任何内容,提示像往常一样出现。当我在Python3 shell上运行import hmmlearn
时,得到的错误与我在问题中发布的错误相同。有什么建议吗?如果你的代码是用py3运行的,那么这就可以解释问题了。您还应该在py3上安装hmmlearn。也许用pip3代替pip