Python hmmlearn中的导入错误



我正在尝试安装python hmmlearn库来构建连续的HMM。我已经从GitHub安装了所有的依赖项和hmmlearn库。安装成功完成。

...
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

但是在python中,当我尝试使用导入GaussianHMM时

from hmmlearn.hmm import GaussianHMM

它给出了一些导入错误:

 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

问题出在 hmmlearn/setup 中.py它没有将实用程序列为子模块。

将此行添加到 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__':

相关内容

  • 没有找到相关文章

最新更新