简体   繁体   English

python hmmlearn中的导入错误

[英]import error in python hmmlearn

I am trying to install python hmmlearn library to build continuous HMM.我正在尝试安装 python hmmlearn 库来构建连续的 HMM。 I have installed all the dependencies and the hmmlearn library from GitHub.我已经从 GitHub 安装了所有依赖项和 hmmlearn 库。 The installation completes successfully.安装成功完成。

...
Processing dependencies for hmmlearn==0.2.1
Searching for scikit-learn==0.18.1
Best match: scikit-learn 0.18.1
Adding scikit-learn 0.18.1 to easy-install.pth file
Using /usr/local/lib/python2.7/dist-packages
Finished processing dependencies for hmmlearn==0.2.1

But in python, when I try to import GaussianHMM using但是在 python 中,当我尝试使用导入 GaussianHMM 时

from hmmlearn.hmm import GaussianHMM

it gives some import error:它给出了一些导入错误:

 Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "hmmlearn/hmm.py", line 22, in <module>
 from .base import _BaseHMM
 File "hmmlearn/base.py", line 13, in <module>
 from . import _hmmc
 ImportError: cannot import name _hmmc

The problem is in hmmlearn/setup.py which doesn't list utils as a submodule.问题出在 hmmlearn/setup.py 中,它没有将 utils 列为子模块。

Add this line to setup.py config.add_subpackage("utils")将此行添加到 setup.py config.add_subpackage("utils")

@@ -18,7 +18,7 @@ def configuration(parent_package='', top_path=None):
         include_dirs=[numpy.get_include()],
         libraries=libraries,
     )
-
+    config.add_subpackage("utils")
     return config

 if __name__ == '__main__':

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM