Python 3.x 导入错误:无法导入名称';将“协方差”矩阵分配到“协方差”类型&“x27”;

Python 3.x 导入错误:无法导入名称';将“协方差”矩阵分配到“协方差”类型&“x27”;,python-3.x,scikit-learn,anaconda,hmmlearn,Python 3.x,Scikit Learn,Anaconda,Hmmlearn,我试图在中运行代码,但从删除的方法“distribute_covar_matrix_to_match_Covare_type”中得到一个导入错误。 我不知道如何在Anaconda中安装不会导致此问题的hmmlearn版本 我在Windows 10上运行此功能时使用的是: (名称、版本、内部版本、频道) hmmlearn,0.3.0b,np112py36_0,omnia scikit学习,0.20.1,py36hb854c30_0 python,3.6.8,h9f7ef89_7 我已经使用以下

我试图在中运行代码,但从删除的方法“distribute_covar_matrix_to_match_Covare_type”中得到一个导入错误。 我不知道如何在Anaconda中安装不会导致此问题的hmmlearn版本

我在Windows 10上运行此功能时使用的是:

  • (名称、版本、内部版本、频道)
  • hmmlearn,0.3.0b,np112py36_0,omnia
  • scikit学习,0.20.1,py36hb854c30_0
  • python,3.6.8,h9f7ef89_7
我已经使用以下命令安装了hmmlearn和scikit learn Through Anaconda:
conda install-c omnia hmmlearn

在我看来,通过Anaconda安装的hmmlearn不是hmmlearn的最新版本,因为在文件
hmm.py
中,这一行存在于sklearn.import中的
(
将矩阵分配到匹配协方差类型,验证协方差
)

在Anaconda中与hmmlearn一起安装的bundeled scikit learn中,删除了
distribute_covar_matrix_to_match_Convarce_type
方法,因为它应该在scikit learn 0.20.1中。()

---------------------------------------------------------------------------
ImportError回溯(最近一次呼叫最后一次)
在里面
---->1从hmmlearn导入hmm
~\Documents\Anaconda\lib\site packages\hmmlearn\hmm.py in
14从scipy.misc导入logsumexp
15来自sklearn导入集群
--->16从sklearn.mixed导入(
17将协方差矩阵分配到匹配协方差类型,验证协方差
18 )
ImportError:无法导入名称“将协方差矩阵分配到匹配协方差类型”
问题似乎是Anaconda正在安装hmmlearn和scikit learn的不兼容版本。有关于如何安装这些软件包的兼容版本的建议吗?

来自@Vivek Kumar run
conda安装-c conda forge hmmlearn

如果不起作用,请删除hmmlearn

conda remove hmmlearn

然后用pip重新安装

pip安装——升级——用户hmmlearn

来自@Vivek Kumar run
conda安装-c conda forge hmmlearn

如果不起作用,请删除hmmlearn

conda remove hmmlearn

然后用pip重新安装


pip安装——升级——用户hmmlearn

根据docs和pypi的最新版本似乎是0.2.1。我不确定0.3.0b版是关于什么的
omnia
似乎是一个自定义频道。您应该始终首先尝试从官方anaconda频道安装。如果不可用,请转到
conda forge
。conda forge中提供的hmmlearn版本为0.2.1。谢谢你@VivekKumar。在我使用命令conda-install-c conda-forge-hmmlearn通过conda-forge安装它之后,它工作了。根据docs和pypi的最新版本似乎是0.2.1。我不确定0.3.0b版是关于什么的
omnia
似乎是一个自定义频道。您应该始终首先尝试从官方anaconda频道安装。如果不可用,请转到
conda forge
。conda forge中提供的hmmlearn版本为0.2.1。谢谢你@VivekKumar。在我通过conda forge使用命令
conda install-c conda forge hmmlearn安装它之后,它工作了
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'