[英]ImportError: cannot import name 'distribute_covar_matrix_to_match_covariance_type'
I'm trying to run the code in the hmmlearn tutorial but I get an import error from the removed method 'distribute_covar_matrix_to_match_covariance_type'.我正在尝试运行hmmlearn 教程中的代码,但从已删除的方法“distribute_covar_matrix_to_match_covariance_type”中收到导入错误。 I don't know how to install a version of hmmlearn in Anaconda that does not cause this problem.
我不知道如何在 Anaconda 中安装不会导致此问题的 hmmlearn 版本。
I'm running this on Windows 10 with:我在 Windows 10 上运行它:
I have installed hmmlearn and scikit-learn though Anaconda with this command: conda install -c omnia hmmlearn
.我已经使用以下命令通过 Anaconda 安装了 hmmlearn 和 scikit-learn:
conda install -c omnia hmmlearn
。
It seems to me as tho the hmmlearn that is installed via Anaconda is not the latest version of hmmlearn because in the file hmm.py
this line exist from sklearn.mixture import ( distribute_covar_matrix_to_match_covariance_type, _validate_covars )
.在我看来,通过 Anaconda 安装的 hmmlearn 不是 hmmlearn 的最新版本,因为在文件
hmm.py
这一行from sklearn.mixture import ( distribute_covar_matrix_to_match_covariance_type, _validate_covars )
。 Compared the the latest version of hmmlearn 对比最新版的hmmlearn
In the bundeled scikit-learn that is installed with hmmlearn in Anaconda the distribute_covar_matrix_to_match_covariance_type
method is removed, as it should be in scikit-learn 0.20.1.在 Anaconda 中与 hmmlearn 一起安装的捆绑 scikit-learn 中,
distribute_covar_matrix_to_match_covariance_type
方法被删除,因为它应该在 scikit-learn 0.20.1 中。 ( It was removed in 0.20 ) ( 它在 0.20 中被移除)
from hmmlearn import hmm
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-19-16c29f744bfe> in <module>
----> 1 from hmmlearn import hmm
~\Documents\Anaconda\lib\site-packages\hmmlearn\hmm.py in <module>
14 from scipy.misc import logsumexp
15 from sklearn import cluster
---> 16 from sklearn.mixture import (
17 distribute_covar_matrix_to_match_covariance_type, _validate_covars
18 )
ImportError: cannot import name 'distribute_covar_matrix_to_match_covariance_type'
The problem seems to be that Anaconda is installing incompatible versions of hmmlearn and scikit-learn.问题似乎是 Anaconda 正在安装不兼容的 hmmlearn 和 scikit-learn 版本。 Any suggestions on how I can install compatible versions of these packages?
关于如何安装这些软件包的兼容版本的任何建议?
From @Vivek Kumar run conda install -c conda-forge hmmlearn
从@Vivek Kumar 运行 conda
conda install -c conda-forge hmmlearn
If that doesn't work remove hmmlearn with如果这不起作用,请删除 hmmlearn
conda remove hmmlearn
then reinstall with pip然后用pip重新安装
pip install --upgrade --user hmmlearn
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.